Getting your Trinity Audio player ready...

Stocks on Thursday recovered most of Wednesday’s losses, as commodity prices continued to sink.

The Dow Jones industrial average gained 261.66 points, or 2.2 percent, to 12,361.32, recouping most of Wednesday’s 293-point decline. An advance by the broader Standard & Poor’s 500 index almost exactly matched Wednesday’s dip, rebounding 31.09, or 2.4 percent, to 1329.51. The Nasdaq composite index added 48.15, or 2.2 percent, to 2258.11. The Russell 2000 index of small-company stocks rose 17.29, or 2.6 percent, to 681.42.

For the week on Wall Street, which is closed Friday for Good Friday, the Dow and the S&P 500 index rose more than 3 percent amid volatile price swings.

Analysts said Thursday’s rally reflected increased optimism toward the beleaguered housing sector. On Wednesday, regulators gave mortgage finance agencies Fannie Mae and Freddie Mac increased authority to lend. On Thursday, Richard Bove, a highly regarded bank stock analyst at Punk Ziegel & Co., declared “the financial crisis is over,” creating “a once-in-a-generation opportunity to buy.”

In addition, Merrill Lynch issued a “buy” recommendation for blue-chip stalwart General Electric. GE shares rose more than 5 percent.

New York Stock Exchange trading volume climbed to 2.71 billion shares, up from 1.97 billion shares Wednesday, reflecting the quarterly expirations of stock-related futures and options contracts.

Winning stocks outnumbered losers by nearly a 3-1 ratio among NYSE-listed stocks. Nasdaq trading volume totaled 2.70 billion shares, up from 2.27 billion shares Wednesday, as winners topped losers by a 2-1 ratio.

Treasury securities eased as stocks advanced. Gold fell nearly 3 percent after losing 6 percent Wednesday.

Crude oil for April delivery dropped 70 cents a barrel, to $101.84.