U.S. stocks gained on Monday on relief that Abu Dhabi's $10 billion aid would help neighboring Dubai avoid default, and a takeover deal by oil and gas giant Exxon Mobil Corp fed optimism about the growth of mergers and acquisitions.

A deal by Citigroup Inc to back U.S. government funds also helped stocks move higher.

Exxon Mobil said it would buy natural gas supplier XTO Energy Inc in an all-stock transaction valued at about $31 billion, excluding debt.

Abu Dhabi said on Monday it will provide Dubai $10 billion in bailout money, $4.1 billion of which is for payment on a maturing bond.

We've tied up a few lose ends here ... Looks like Dubai got tied up pretty well, looks like M&A is back with Exxon, and it sends a message of valuation that companies are still cheap and that we have not gone too far too fast, said Burt White, chief investment officer at LPL Financial in Boston. It's a signal to investors we still have room to extend this rally,

The Dow Jones industrial average <.DJI> was up 27.81 points, or 0.27 percent, at 10,499.31. The Standard & Poor's 500 Index <.SPX> was up 6.36 points, or 0.57 percent, at 1,112.77. The Nasdaq Composite Index <.IXIC> was up 14.23 points, or 0.65 percent, at 2,204.54.

Citigroup laid out a plan to repay the money it owes the U.S. government, including raising money by issuing $17 billion of stock immediately, as the bank looks to end the executive pay restrictions that came with the funds.

Citi shares fell 4.6 percent to $3.77.

Citi's stock is trading down because of dilution, but (the deal) is good in terms of getting the government out from underneath them and having the banks prove they don't need government in the system, said Peter Boockvar, equity strategist at Miller Tabak & Co in New York.

Shares of XTO jumped 15.6 percent to $47.97 and Exxon Mobil fell 3.9 percent to $69.94. The First Trust ISE-Revere Natural Gas Index Fund , a natural-gas companies exchange-traded fund, rose 5 percent. XTO has underperformed that ETF by roughly 14 percent this year.

Sun Microsystems Inc shares jumped 10.1 percent to $9.20 after European Union regulators signaled they could clear Oracle Corp's $7 billion takeover of Sun after Oracle promised measures to ease competition concerns. Oracle shares gained 2 percent to $23.25.

Britain's Cadbury Plc said it has received interest from other bidders after raising its growth targets and reporting upbeat trading as it dismissed a $16.5 billion bid from Kraft Foods Inc .

The White House said U.S. President Barack Obama will make a statement on the economy after a meeting with the heads of the top U.S. banks scheduled for Monday morning.

(Editing by Padraic Cassidy)