The Dow and S&P 500 closed out their fourth week of losses with a small gain on Friday, but only with the help of a weaker dollar boosting metals prices and basic materials stocks.

Thin trading made for a lackluster day on Wall Street, with desks short-staffed before the Memorial Day holiday that will keep U.S. markets closed on Monday. Volume was the second lightest so far this year.

The greenback fell broadly after weaker-than-expected U.S. consumer spending and housing data stoked worries that the economic recovery is losing momentum. The U.S. Dollar Index <.DXY> fell 1 percent, its largest drop since January 13.

Freeport-McMoRan Copper & Gold Inc rose 2.7 percent to $51.73. The S&P materials sector index <.GSPM> added 1.03 percent as the dollar's decline helped lift the prices of metals and other commodities. The Reuters-Jefferies CRB index <.CRB> was headed for a third straight week of gains.

The inverse correlation of the dollar to equities seems to be a trend that you can focus on as an investor for the time being, said Michael Sheldon, chief market strategist at RDM Financial in Westport, Connecticut.

The logic is that a weaker dollar helps increase exports, sales and profits for multinational companies in the United States.

The Dow Jones industrial average <.DJI> added 38.82 points, or 0.31 percent, to 12,441.58. The Standard & Poor's 500 Index <.SPX> rose 5.41 points, or 0.41 percent, to 1,331.10. The Nasdaq Composite Index <.IXIC> gained 13.94 points, or 0.50 percent, to 2,796.86.

For the week, the Dow lost 0.56 percent, the S&P shed 0.16 percent and the Nasdaq dropped 0.23 percent.

It was the fourth straight week of losses for both the Dow and the S&P 500. For the Nasdaq, it was the third decline in the last four weeks.

About 5.44 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, the second-lowest trading volume so far in 2011 by a thin margin. It fell way below last year's estimated daily average of 8.47 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of nearly 3 to 1, while on the Nasdaq, nearly two stocks rose for every one that fell.

Bank stocks led gains in Europe and also boosted the U.S. market. Bank of America , which had the heaviest turnover on the New York Stock Exchange, rose 2 percent to $11.69. It was the Dow's biggest percentage gainer.

Medco Health Solutions Inc will lose a major pharmacy benefit contract to CVS Caremark Corp starting next year, a setback that drove its shares down 9 percent to $58.66. CVS shares rose 1.7 percent to $38.80.

On the macroeconomic front, separate reports showed the U.S. economy remained sluggish early in the second quarter with high gasoline prices crimping consumer spending and bad weather helping to push home resales to a seven-month low in April.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)