When you're in your 20s, you tend to work hard and play hard. But as you get older and settle down, you may find yourself thinking more about the future and trying to keep everything you've worked for, rather than scrambling to build wealth.

As your attitudes and priorities shift, your investment strategy should evolve with them. So here are some smart moves to make as you inch closer to retirement.

1. Max out your 401(k) contributions
While the money you contribute to a 401(k) during your last few years in the workforce won't have much time to grow, you're best off contributing as much as you can while you're still bringing in a steady paycheck. This especially holds true if your employer offers a generous matching program. For 2015, the pre-tax contribution limit for 401(k) plan is $18,000, but if you're 50 or older, you can tack on another $6,000 as a catch-up contribution.

Let's say you're 55 years old with a 401(k) balance of $100,000, and you want to retire in 10 years. If you max out your contributions, including your catch-up allotment, for a total of $24,000 a year for the next 10 years, then you'll have an ending balance of $578,000 assuming no employer match and an average annual return of 8%. By contrast, if you opt to allocate $12,000, or half maximum, for the next 10 years, then you'll end up with just $397,000 based on the same assumptions.

2. Consider an IRA rollover
It used to be that you couldn't roll your 401(k) into an IRA without leaving your job. These days, many plans allow you to roll your 401(k) into an IRA starting at age 59-1/2, and doing so might offer you better opportunities to diversify your retirement investments, as IRAs offer more options than 401(k) plans do. Many 401(k) plans limit you to specific funds chosen by your employer, but with an IRA, you're free to invest your money in just about anything, from stocks to bonds to mutual funds. Remember, the closer you get to retirement, the more critical diversification becomes. Having a wide array of investments can serve as a major source of protection during periods of market volatility, so think of an IRA as a blank canvas for mapping out a more comprehensive investment strategy. 

3. Choose investments that aren't as risky
When you're in your 20s and 30s, you have several decades in the working world ahead of you, which means you're more free to take risks in the hope that they yield high rewards. As you get closer to retirement, however, you should shift some, though not all, of your investments into lower-risk assets, as your portfolio doesn't have as much time to recover from market downturns. For many, this means moving away from stocks and putting more money into bonds, which are a safer short-term bet. Another option, if you're looking for an investment that's less fickle than stocks but more likely to beat inflation than bonds, then consider putting money into ETFs. Exchange-traded funds offer built-in diversification and have much lower management fees than those associated with mutual funds. A good bet is a fund that seeks to track total U.S. stock market performance, such as Vanguard's Total Stock Market ETF.

4. Build a bond ladder
While bonds are generally considered to be a safer investment than stocks for near-retirees, they're not without risk. If a bond-heavy strategy appeals to you, you may want to consider laddering your investment so that your bonds' respective maturity dates are evenly scattered throughout your target investment period. Taking this approach will help you minimize both your interest rate risk and your reinvestment risk (though you may not be as concerned with the latter, as there's a good chance you'll be using your proceeds to fund your retirement lifestyle).

5. Create a budget
If you've never mapped out an official budget before, now's the time to do so. The sooner you get used to the idea of following a budget, the better off you'll be in retirement, when you'll have far less wiggle room. Review your monthly bills to figure out your fixed costs, and then build in some room for the variable costs you might encounter, such as home repairs. Compare what you're spending with what you're earning now, and also with the amount you're expecting to have available during retirement. While your monthly expenses may go down a bit in retirement, if you're within a few years of leaving the workforce, there's a good chance your current bills will accurately reflect your initial living costs.

Those last few years in the working world are your final opportunity to set yourself up for retirement success. Whether you decide to tweak your investment strategy or ramp up your retirement plan contributions, the key is to get a handle on your finances while you still have a chance to make some changes for the better. A few simple moves could set you on a course for a smooth, financially stable retirement.

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.