NEW YORK — Wall Street stumbled through another volatile session but ended with a respectable gain Thursday after a multibillion dollar deal between Dow Chemical and rival Rohm and Haas helped offset concerns about the financial sector and energy costs.

The market still struggled with its twin trouble spots: the financial sector and the price of oil.

Shares of mortgage finance companies Fannie Mae and Freddie Mac plunged skidded lower on worries they will be forced to sell more new shares than anticipated to compensate for losses from the housing slump. Fannie shares fell nearly 14 percent and Freddie shares dropped more than 22 percent. Investment banks were also weak, as Lehman Brothers Holdings Inc. lost more than 12 percent.

The declines in financials came after Treasury Secretary Henry Paulson told Congress Wall Street can't expect the government to bail out troubled financial companies.

"For market discipline to effectively constrain risk, financial institutions must be allowed to fail," Paulson said.

Meanwhile, crude oil prices rebounded by more than $5 to more than $141 a barrel.

Though investors found a reason to buy after Dow Chemical's $15 billion all-cash acquisition of the special chemicals maker Rohm and Haas, they are cautious ahead of quarterly earnings, in particular financial results due next week.

"Investors lack real clarity from the banks," said Marc Pado, U.S. market strategist at Cantor Fitzgerald in New York. "It's this uncertainty that keeps investors out of the market so what you get is a situation where you're reacting to news. There are a lot of crosscurrents."

According to preliminary calculations, the Dow Jones industrial average finished up 81.58, or 0.73 percent, at 11,229.02. But oil's resurgence back above $141 a barrel briefly pulled the Dow into negative territory in afternoon trading.

Broader stock indicators also finished higher. The Standard & Poor's 500 index gained 8.70, or 0.70 percent, to 1,253.39, while the Nasdaq composite index rose 22.96, or 1.03 percent, to 2,257.85.