Several months before buying real estate, it is a good idea to "age" your money before applying for a mortgage. Bankers like stable balances. Most lenders still require 3+ months of account statements, and any large sum that was moved during this time will have to be explained. Thus, it's a good idea to plan a long time in advance. Slowly and steadily build the balance in your 401k or savings account leading up to the mortgage application. Take out that consolidation loan six months ahead of time, or buy that car the year before applying for a mortgage. A "clean" set of account statements will make the mortgage process smoother.
After contracting to purchase a home and applying for a mortgage, move as little money around as possible. It could delay the process and one could lose a locked rate or fail to be approved. In rural areas or peak times, it can take 30+ days for a bank to get property appraised, and just before closing the bank may ask for current statements. Any large spending or asset movement will require an explanation.
Somewhat related, when applying for a mortgage, one has to declare whether one has borrowed money for the down payment. There is a check-box or other place to note this on the application form. There are odd implications with this declaration. Did you take a 401k loan out two years ago and then save and age the money? Did your brother-in-law give you a temporary small loan with favorable terms? Technically, such loans are supposed to be declared if the proceeds will be used for the down payment. Omissions can be considered illegal, and a form of bank fraud.
In the 1980s and subsequent real estate bust, people were getting multiple credit cards, taking out large cash advances, and using the proceeds for down payments on real estate. This led to tighter lending standards, and more mortgage borrower declarations (in the 2000s, the real estate bust was caused by the bankers using credit scores alone to lend large sums which is incredibly risky, so the whole system is tainted a bit).