Cracks are starting to appear in the municipal bond market. If you’re investing for income, it’s time to pay attention. Consider: Three California cities filed for bankruptcy this summer — unusual in such a short period — and ratings agencies warn that more trouble is coming. “We expect local governments to be struggling with this through 2013,” says Robert Kurtter, managing director, public finance, at Moody’s Investors Service. Berkshire Hathaway BRKA 0% recently disclosed it was terminating half its contracts that insure against muni bond defaults — a sign, perhaps, that Warren Buffett is increasingly worried about the public sector’s fiscal health. Policymakers looking to shrink the federal deficit are discussing limits on the tax benefits of munis, normally exempt from federal and, in some cases, state income taxes. Related: Best banks 2012 Yet the muni market skates along seemingly carefree, handily beating the returns of taxable bonds. Last year the Barclays Capital Municipal Bond index returned 10.7%, including capital gains and yield; it’s up more than 5% this year. With Treasury rates so low, investors have been scooping up munis en masse, especially lower-quality credits that offer fat yields. “Most of the flows into the market this year have been chasing recent performance,” says Matt Fabian, managing director of Municipal Market Advisors. That strategy rarely turns out well. While you don’t need to bail on munis, to avoid trouble follow this more prudent path instead. Buy high, sell low Quality, that is. Lower-quality, or junk, munis can be good deals when the price is right. Not now. Demand has pushed average yields down to 5.9%, from 7% a year ago (as bond prices rise, yields fall), even as default risk grows. “The bull market in munis has lifted all boats, no matter if it’s a dinghy or a cruiser,” says Marilyn Cohen, president of Envision Capital. Sell those dinghies now. The market for high-yielding junk is notoriously fickle. “If something goes wrong, the whole sector can go bad,” says John Flahive, director of fixed income at BNY Mellon Wealth Management. Related: The case for investing in bonds, too In contrast, munis with credit ratings of double A or higher are easy to trade, carry lower risk, and still offer relatively attractive yields. High-quality munis that mature in 10 years yield more than 2% today. In the 28% income tax bracket, that’s a tax-equivalent yield of roughly 3%. A 10-year Treasury, meanwhile, recently paid out just 1.8%. Go middle, not long The yield on a triple-A, 30-year muni is 1.3 percentage points higher than for a 10-year. Sounds tempting, but the reality is that’s a small premium for locking up your money, and the spread is narrowing. Yields on long-term bonds have declined by 0.6 percentage points from last year; the 10-year has given up just a third of that. “The attractiveness of longer yields has diminished,” says BNY Mellon’s Flahive. You’ll find better value in the intermediate part of the market, bonds with maturities between seven and 15 years. “That is the sweet spot,” says Cohen. Spread your bets If you buy individual bonds, you needn’t worry about losing principal to market gyrations (as long as you hold the bond to maturity). You do, however, have to consider credit risk — and today that risk is rising. State finances, for the most part, are on the mend, but cities haven’t recouped losses in property taxes, which account for nearly three-quarters of their tax revenue. So that you don’t get caught unawares, monitor the bonds you own, and check on the finances of municipal issuers. For new purchases, avoid bonds susceptible to economic shocks, such as those backed by revenue from, say, convention centers. Stick to general-obligation (backed by taxing power) and essential-service revenue (such as water and sewage) bonds. Invest in areas where the housing market is recovering and unions and government aren’t at each other’s throats. With more than 50,000 issuers, you’ll find plenty of options. “You can’t paint the entire country with the same brush,” says Chris Mauro, director of municipal bond research at RBC Capital Markets. If you live in a high-tax state, the tax break you get by investing in your state’s obligations is a big benefit — except many of those places, including California, Illinois, and New Jersey, are in bad financial shape. That doesn’t mean you have to avoid them altogether. “I don’t see any state out there where all the muni bonds are in great risk,” says Dan Loughran, who leads the Rochester municipal investment team at Oppenheimer Funds. To minimize potential losses, stick with bonds that, by law, have priority over other obligations. In California, state G.O. bonds rank second (after public education) for payouts. Rhode Island recently passed a law that requires G.O. bondholders to be paid first if a local government goes bankrupt. Related: Send your investing questions to the Help Desk Another option: Invest in a single-state fund that has the majority of assets in intermediate-term bonds rated double A or better. (Check at Morningstar.com under the “portfolio” tab once you’ve typed in the fund’s ticker symbol.) Also, make sure fund managers aren’t too fond of this trick to boost yield: investing in bonds of U.S. territories. (Review the fund’s top holdings at Morningstar or the fund’s website.) Those bonds pay higher yields but are riskier. Avoid funds that have close to 10% of assets or more invested this way. If you live in a low or no-income-tax state, the cheapest, easiest way to minimize risk is through a national fund that focuses on high-quality, intermediate-term credits. Miriam Sjoblom, an analyst at Morningstar, likes Fidelity Intermediate Municipal Income FIDELITY INTERMEDIATE MUNI INCOME FLTMX 0.1% . A good low-cost option on our MONEY 70 list of recommended funds is Vanguard Intermediate-Term Tax-Exempt VANGUARD INTERM-TERM TAX-EXEMPT INV VWITX 0.21% . Both yield around 3%. Not earth-shattering, but solid.