The Dow gained 78.56 points to 13,248.44, after climbing as much as 137 points earlier. The Standard & Poor's 500 index finished up 9.29 points at 1,427.84. Both the Dow and the S&P have risen for five straight days.
The Nasdaq composite ended up 35.34 points at 3,022.30.
Delta Air Lines rose 52 cents, or 5.1 percent, to $10.66 after the company said it will buy almost half of Richard Branson's Virgin Atlantic for $360 million as it seeks a bigger share of the lucrative New York-to-London travel market.
AIG gained $1.90 to $35.26 after the U.S. Treasury Department said it has sold the rest of its stake in the insurer. AIG was bailed out by the government after nearly collapsing during the 2008 financial crisis.
Stocks have edged up since the start of the month as investors watch for developments in the budget talks. Tax increases and federal spending cuts are scheduled to start Jan. 1 unless a deal is reached to reduce the U.S. budget deficit. Economists say the measures, if implemented, could eventually push the economy back into recession.
The S&P 500 fell as much as 5 percent after the U.S. presidential election Nov. 6 as investors worried that gridlock in Washington would prevent a budget deal. With Tuesday's advance, the S&P 500 has recouped almost all of the ground it lost since the election when it closed at 1,428.39.
The Wall Street Journal reported that budget negotiations between the White House and Republican House Speaker John Boehner had "progressed steadily" in recent days. That reinvigorated talks that appeared to have stalled, the paper reported, citing people close to the process.
Stock markets stayed higher even after Boehner said midday Tuesday that President Barack Obama is slow-walking talks to avoid the fiscal cliff, and hasn't outlined spending cuts he's willing to support as part of a compromise. Senate Majority Leader Harry Reid said Tuesday afternoon that it would be "extremely difficult" to pass legislation to address the so-called fiscal cliff before Christmas, but added there's still a chance it can be done.
"The market has been very susceptible to 'fiscal cliff' headlines," said Todd Salamone, a senior vice president at Schaeffers Investment Research, adding that stocks have rallied more on good news than they have fallen on indications that talks were stalling. "It seems the expectation is that something will get done, but it's a very cautious expectation. There's a lot of money on the sidelines."
Stocks are holding on to their gains for the year. The Dow Jones is up 8.4 percent since the start of the year, while the S&P 500 has gained 13.5 percent.
The Federal Reserve is expected to announce a new bond-buying plan to support the U.S. economy with the goal of further reducing long-term interest rates and encouraging borrowing by companies and individuals. Once its two-day policy meeting ends Wednesday, the Fed is likely to say it will start buying more long-term Treasurys to replace a program that expires at year's end.
"I would be a huge shock to the system if it wasn't continued," said Dave Abate, a senior wealth advisor with Strategic Wealth Partners in Seven Hills, Ohio. "The markets across the boards are pricing in a continuation of the stimulus."
Investors were also encouraged by a report that showed an index of German investor optimism rose more than expected in December, suggesting market professionals think Europe's largest economy will avoid an outright recession.
The yield on the 10-year Treasury note rose 4 basis points to 1.66 percent.
Other stocks making big moves:
—Urban Outfitters rose $1.65, or 4.5 percent, to $38.65 after the company reported rising sales. The retailer, which operates Anthropologie, Free People and its namesake stores, reported its third-quarter results in November, which fell just short of market expectations.
—Dollar General fell $3.63, or 7.8 percent, to $42.94 after the company said that while its sales over the Thanksgiving weekend and the start of the holiday shopping season were encouraging, it remains cautious about the rest of the year, noting that consumer spending remains tight.
— TripAdvisor jumped $2.52, or 6.6 percent, to $40.91. Liberty Interactive agreed to increase its stake in the travel website by buying a block of shares from media mogul Barry Diller and The Diller-von Furstenberg Family Foundation. Liberty will gain control of the company.