Stocks gained Monday, ending a volatile session moderately higher, as investors looked beyond massive job cuts at several U.S. companies and chose to buy stocks battered in last week's sell-off. Stocks opened higher on merger news and unexpectedly positive U.S. economic reports before falling in the afternoon, largely due to massive layoffs announced Monday. Stocks rose again in the last 90 minutes of trading. Pharmaceutical giant Pfizer is buying rival Wyeth in a $68 billion deal that values Wyeth 15 percent above Friday's closing stock price. The transaction helped investor sentiment by showing that deal-making is still happening despite the recession. However, several companies announced significant job cuts, including Caterpillar, GM, Home Depot, and Sprint Nextel. In economic news, U.S. existing-home sales rose unexpectedly in December, an association reported, but the median sales price fell over 15 percent from a year ago, the biggest 12-month drop since records have been kept. In a second report, a private group said its index of U.S. leading economic indicators unexpectedly rose 0.3 percent last month. Light sweet crude oil for March delivery fell 74 cents to $45.73 a barrel on New York Mercantile Exchange. The U.S. dollar fell versus the euro and gained versus the yen. The Dow Jones industrial average rose 38.47, or 0.5 percent, to 8,116.03. Pfizer shares lost 10 percent following its acquisition announcement. Shares of Caterpillar fell 9 percent after the heavy-equipment maker said it will cut 20,000 jobs due to difficult global economic conditions. Home Depot announced the elimination of 7,000 jobs, and shares of the home-improvement retailer rose 5 percent. Wireless telephone carrier Sprint Nextel said it will cut up to 8,000 jobs, and its shares rose 1 percent. McDonald's reported weaker quarterly profits that still beat expectations. Its shares rose slightly. The broader Standard & Poor's 500 index rose 4.62, or 0.6 percent, to 836.57. The technology-heavy Nasdaq composite index rose 12.17, or 0.8 percent, to 1,489.46. The New York Stock Exchange composite index rose 49.06 to 5,244.61. The American Stock Exchange composite index rose 26.45 to 1,388.37. And the Russell 2000 index rose 5.70 to 450.06.