U.S. stocks rose on Wednesday after Federal Reserve Chairman Ben Bernanke reaffirmed his commitment to keep interest rates low for an extended period.

But stocks were off session highs after the government said sales of newly built U.S. single-family homes fell unexpectedly to a record low in January, hinting at potential trouble for the fragile housing recovery.

Home builder stocks fell sharply, with D.R. Horton Inc off 3.2 percent to $12.17, helping to push the Dow Jones Home construction index <.DJUSHB> down 3.1 percent.

It's awful. This is with the home buyer tax credit. I don't understand people who say the housing market is turning. This number tells you housing is dead still, said Joe Saluzzi, co-manager of trading at Themis Trading in Chatham, New Jersey.

Meanwhile, Bernanke told Congress on Wednesday that a weak job market and low inflation would likely allow the central bank to keep interest rates at very low levels for a long time.

The Dow Jones industrial average <.DJI> gained 35.98 points, or 0.35 percent, to 10,318.39. The Standard & Poor's 500 Index <.SPX> added 3.15 points, or 0.29 percent, to 1,097.75. The Nasdaq Composite Index <.IXIC> rose 13.20 points, or 0.60 percent, to 2,226.64.

Helping the Nasdaq, Autodesk Inc gained 8.8 percent to $27.91 after the architectural software company posted better-than-expected quarterly results late Tuesday.

H&R Block Inc fell 16 percent to $16.57 after the largest U.S. tax preparer said it would miss its fiscal 2010 outlook as high unemployment has led to a drop in tax filings.

(Reporting by Edward Krudy; editing by Jeffrey Benkoe)