Afraid of running out of money before you die? Luckily for you, longevity insurance can protect you from the prospect of a grisly retirement.

According to a new study from the folks at the Employee Benefit Research Institute (EBRI), nearly half of those aged 56 to 62 will run out of cash within 20 years of retirement. The picture isn't much prettier for younger Boomers (nearly 44%) or Gen Xers (45%).

But look, up in the sky! It's longevity insurance to the rescue! Longevity insurance works a little like immediate annuities, which offer purchasers pension-like income -- except that this investment is designed to kick in at a point when your other income might have dried up.

If the poor souls set to run out of retirement funds within 20 years buy this longevity insurance around age 65, they can set it to start paying them at age 85. This can make living until age 95 more of a blessing, and less of a curse.

Essentially, longevity insurance protects you against ruin -- as long as you live long enough to receive the payouts. But that's really no different than the risks you take with every other kind of  insurance. The peace of mind in knowing you're protected often outweighs the expense of paying up every year for a disaster that (hopefully) never comes.

A $10,000 lump sum payment at age 65 can provide you with $166 per month in longevity insurance beginning at age 75, or a much more significant $638 monthly if you start taking the payouts at age 85. Why the big difference? Many policy-holders won't make it to age 85 -- but for those who do, the wait can be well worth it.

Longevity insurance can improve your quality of life all throughout your retirement, too. Instead of worrying about making your money last until, well, whenever  you die, you can spend more freely, and gain greater enjoyment from your life.

Of course, longevity insurance isn't for everyone. Think through your own retirement plan, and perhaps consult with a financial advisor to see whether it's right for you. If so, do your homework to find the right arrangement at the best price.

Investors should bear in mind that this kind of annuity will likely grow in popularity as our population ages, enriching insurers such as MetLife (NYSE: MET), Hartford Financial Services (NYSE: HIG), Symetra Financial, and Genworth Financial (NYSE: GNW).

Longtime Fool contributor Selena Maranjian does not own shares of any companies mentioned in this article. Try any of our investing newsletter services free for 30 days. The Motley Fool is Fools writing for Fools.