Moody's had lowered the outlook to "negative" two years ago. But it never went as far as rival Standard & Poor's, which stripped the U.S. of its top credit rating in 2011.
S&P last month upgraded its outlook for long-term U.S. government debt but kept its rating at AA+, a notch below its top grade.
A stronger credit outlook and rating should allow governments to borrow at lower interest rates by signaling that their bonds are less risky. Weaker credit ratings should force them to pay higher rates.
But investors largely ignored S&P's downgrade in 2011. Stocks fell briefly and then rebounded. Yields on Treasurys later fell to record lows.
An improving economy and tax hikes and spending cuts that took effect this year have narrowed the government's budget gap.
Still, Moody's warned that the government needed to control longer-term deficits as Baby Boomers age and begin to collect Social Security and Medicare. Failure to do so "could put the rating under pressure again."