That's right: This rally is done. But I'm not talking about stocks; I'm referring to the bond rally.

Over the past decade, while the S&P 500 index has lost an annualized 0.2%, the Barclays Aggregate Bond Index has posted a 6.4% gain. Investors have responded by stuffing hundreds of billions of dollars into bond funds in the past year and a half. But investors should be warned that the party in this sector is drawing to a close.

Closing time
While bonds and the mutual funds and ETFs that invest in them will continue to provide a measure of relative safety for investors looking to preserve capital, folks who think fixed-income instruments will continue to beat stocks by such a wide margin may be in for a disappointment. The simple truth is that interest rates are at historic lows, and when rates eventually go up, bond prices will go down. Given the fragile state of our economic recovery, the Fed may not start raising rates until late this year or even early in 2011, but it will happen. And when it does, longer-term bonds will suffer.

Bond luminary Bill Gross recently stated that the nearly three-decade rally in the bond market is likely drawing to a close. He predicts that higher sovereign debt levels, along with greater government regulation and higher future interest rates, will result in generally lower returns in the near future. Given the fact that Gross' Pimco recently opened its very first actively managed stock fund, it looks like Gross is putting his money where his mouth is: in equities.

Digging for bargains
But even though the current bull market for bonds is likely winding down, that doesn't mean there aren't still pockets of opportunity within the bond market. For example, even though many states are struggling with budgetary issues, municipal bonds still look relatively attractive from a yield perspective. The interest on these bonds is exempt from federal taxes and if you live in the state that issues the bond, it is also exempt from state and local taxes. Municipal bonds make a lot of sense for investors in higher tax brackets, thanks to the greater relief from taxes. You can pick up individual state-specific or federal municipal bonds, or invest in an exchange-traded fund that does the work for you.

If you're looking for federal municipal bonds, one good choice is Market Vectors Intermediate Muni ETF (NYSE: ITM). Several ETFs and actively managed funds that focus on specific state muni bonds are also available.

Likewise, you might want to make room in your portfolio for high-yield bonds, if you can stomach the risks. High-yield bonds frequently act more like stocks than bonds, from both a risk and return standpoint, so keep overall allocations here pretty low. And while much of the juice has been squeezed out of this sector as the economy has recovered and credit defaults have dropped, yields in this sector are still fairly attractive, compared to yields on comparable government Treasuries.

Don't expect the home run returns of 2009 to repeat themselves, but there is still a bit of room left to run here. If you want broad-market coverage in one shot, consider the SPDR Barclays Capital High Yield Bond ETF (NYSE: JNK), but be prepared for a potentially wild ride.

In it for the long run
While it may be wise to make a few tactical adjustments into more attractive bond sectors like those mentioned above, don't try to completely overhaul your bond allocation. If you buy individual bonds, it might help to shorten your duration a bit by moving more heavily into shorter-term bonds. These instruments will be much less affected by rising rates since they mature quickly and you can roll over the proceeds into newer, higher-yielding bonds.

But beyond that, if you're a long-term investor, for the most part you should stick to your long-term plan. Even though bonds' best days may be behind them, every investor still needs the volatility-reducing power of fixed-income securities. If you're looking for cheap, broad-market bond coverage, two of the best options are the iShares Barclays Aggregate Bond ETF (NYSE: AGG) and Vanguard Total Bond Market ETF (NYSE: BND).

However, if you've got new money to put to work, consider adding to your equity holdings, which will likely offer greater return opportunities going forward. Thanks to the turmoil in Greece and elsewhere in Europe, foreign markets have taken a tumble in recent weeks. And while Europe is likely to struggle for some time to come, you can find good opportunities elsewhere around the globe. For instance, although emerging markets aren't nearly as attractive as they were a year or so ago, they are still likely to provide some of the best global growth opportunities in the coming decade. Good options for wide, inexpensive coverage include Vanguard Emerging Markets Stock ETF (NYSE: VWO) and iShares Emerging Markets Index (NYSE: EEM).

Ultimately, investors would be wise to moderate their expectations for bond returns. Bonds aren't likely to lose money in the near future, but chances are pretty good that their returns will be muted and that stocks will outperform in the next phase of the market cycle.

While bonds still serve a vital role in every investor's portfolio, just make sure you're not banking your entire future on them.