When you're saving for retirement, it can be easy to fall into a rut. You get into a routine of saving a little bit each paycheck -- which is great! But it's easy to lose sight of your overall goals and how close you are to reaching them by the time you retire. Then, before you know it, you're in your 60s and you're falling behind on your financial goals.

If that sounds familiar, you're not alone. Nearly half (46%) of baby boomers have nothing saved for retirement, according to a study from the Insured Retirement Institute. And once you reach retirement age, there's little you can do to catch up. That's why it's important to start setting goals for yourself well in advance of retirement so you can make adjustments with plenty of time to spare.

Dollar bills with clock stopwatch on top

Image source: Getty Images.

By the time you reach age 40, you should already be well on your way to building a strong retirement nest egg. But there are a few other milestones to shoot for well before retirement age:

1. Have a solid emergency fund

Emergencies can happen at any age, but most Americans aren't financially prepared for them. In fact, only 39% of Americans have enough in their savings accounts to cover a $1,000 emergency expense, according to Bankrate's latest financial security survey.

Whether your car is making an ugly noise, your water heater suddenly stops working, or you find yourself in the hospital after an accident, these types of expenses are guaranteed to pop up at some point. And if you don't have the cash to pay for them, your only options include taking out a costly loan, putting it on a credit card and racking up debt, or pulling money from your retirement fund.

Also, should you lose your job, an emergency fund can help cover expenses for a few months while you look for employment, saving you from having to sneak money from your nest egg. Ideally, you should have enough stashed away to cover three to six months' worth of living expenses in the event of a job loss or unexpected expense. That will protect your finances and keep you on track to reach your retirement goals.

2. Pay down all high-interest debt

Not all debt is bad, but high-interest debt (like credit card debt) can be toxic. This type of debt can take years to pay off, and you could end up paying thousands of dollars in interest alone.

For example, say you have $5,000 in credit card debt with an interest rate of 16%, and you're paying $175 per month. At that rate, it will take over 12 years to pay it off, and you'll end up paying a total of around $7,927 -- roughly $3,000 of which is in interest payments alone.

The longer it takes to pay down debt, the more you'll be paying in interest. By paying down all your high-interest debt by the time you reach 40, you'll be able to make better use of that money by investing it in your retirement fund or stashing it away in an emergency savings account.

3. Have three times your salary saved for retirement

By age 40, you should have an established retirement fund. While there's no concrete number as to exactly how much you should have saved by this age, Fidelity recommends having three times your annual salary saved by the time you turn 40.

Considering the fact that almost half of baby boomers have nothing at all in their retirement funds, this may seem impossible. But the key to saving for retirement is to simply get started, because the longer you wait, the harder it will be to catch up.

For example, say you're 40 and you haven't saved a dime for retirement. You may think that it's too late to get started, but that's simply not true. If you want to retire at, say, 67, you still have 27 years to save. 

Let's say you're saving $200 per month earning a 7% annual rate of return on your investment. After 27 years, that amounts to roughly $185,469. Also, if your employer offers matching 401(k) contributions, you could potentially double your savings with zero extra effort on your part.

It's never too late to start saving, but the earlier you start, the easier it will be. At 40, you still have plenty of time before retirement. But it's also important to be setting financial goals for yourself to ensure you're on the right track.