Those drawing close to retirement are usually advised to move their money into safer investments. These investments carry less risk, but also have a far lower yield. The result is a lower risk of losing money at the cost of potentially not having enough to retire. Since most dips in the market are short term, it may be wise for many would-be-retirees to hold onto their stocks a bit longer.
Another option many retirees consider is moving their cash in and out of various accounts depending on their market sentiment. For example, the market seems bad right now so they could move their money into safer vehicles. Unfortunately, individual investors are notoriously bad at timing the market. After all, the market seems the worst at the bottom and the best at the top - everyone's late to the party.
The best recommendation is to create a long-term portfolio that contains a healthy mix of risk and reward potential. Invest your 401(k) in a mix of stocks and bonds that protect you against the ups and downs but also give you a decent stab at capital appreciation through high returns. The correct blend for you depends on many factors and it might be best to visit a financial advisor to help you put together a portfolio.
Typically, during the five to ten years leading up to retirement, you should have 65% of your retirement assets invested in a diversified group of stocks and the rest in bonds. Gradually, these funds should shift more into safer bond funds in order to lower the risk. By the time you retire, you should still have 55% of your retirement assets in stocks since you are not selling it all at once.
One final word of caution: Be careful when using a financial advisor these days. Many claim to be experts when they really pursue their own goals. Many receive kickbacks from funds that they invest your assets in, so make sure you check to see who they are REALLY working for. Typically, the best advisors charge you a fee and work on your behalf.