There are a number of things as seller can do, but nothing can guarantee something won't happen.
The first thing you should do is hire only the best, most capable and experienced listing agent who will monitor the transaction from before listing to past closing.
Reviewing the pre-approval letters and qualifications of the buyer is a critical step that is often overlooked. Some are very weak and others indicate a very thorough process has been completed and the buyers are truly pre-approved.
Insuring you are prepared for various possibilities so they don't take you by surprise. The most common lately has been appraisal issues. If you are under contract and the home does not appraise for the agreed upon price, a quality agent will have the ability to review the appraisal and hopefully get it reviewed and revised for valid reasons.
In the end, there is always some risk. I had a buyer lose their job at the last minute, through no fault of their own. No job, no loan, no sale.