Stocks ended near the session's highs on Thursday, with investors favoring shares of retailers after encouraging chain-store sales raised confidence ahead of Friday's jobs report.

The Morgan Stanley retail index <.MVR> rose 2.8 percent, driven by companies such as Sears Holdings Corp , up almost 8 percent, and Ross Stores Inc , up 6 percent and at a new high.

U.S. chain-store sales climbed 4.8 percent in January. Along with rising service-sector activity and improved jobless claims figures, the stronger-than-expected retail figures added to growing evidence of an economic rebound.

The strength in the retail sector is probably the standout feature today, said Nick Kalivas, an analyst at MF Global in Chicago. You have generally a profit-taking, consolidative market after a couple of days of big run-ups (and) in front of the employment report tomorrow.

The wider market had come under pressure for most of the day as some investors said stocks were extended after weeks of gains, while a stronger dollar weighed on the natural resource sector.

Kalivas said the material and energy sectors were ripe for profit-taking while retail stocks had lagged the rally since the beginning of the year over concerns about the strength of consumer spending.

The Dow Jones industrial average <.DJI> gained 20.29 points, or 0.17 percent, to 12,062.26. The Standard & Poor's 500 Index <.SPX> rose 3.07 points, or 0.24 percent, to 1,307.10. The Nasdaq Composite Index <.IXIC> added 4.32 points, or 0.16 percent, to 2,753.88.

The S&P 500 has rallied more than 10 percent since breaking out of a trading range at the start of December and is up 21 percent since the end of August.

Data showed the U.S. services sector grew in January at its fastest pace since August 2005, and initial claims in the latest week for state unemployment benefits fell more than expected.

The S&P's energy sector <.GSPE> has been the top gainer this year, rallying 9.4 percent, while industrials <.GSPI> and technology <.GSPT> each have rallied 6 percent. Over that time the Morgan Stanley retail index has fallen 2.5 percent.

The strong performance in retail shares comes ahead of Friday's employment report that is expected to show the U.S. economy added 145,000 jobs in January.

Also in the retail sector BJ's Wholesale Club Inc said it may put itself up for sale. Shares of BJ's, which is under pressure from a private equity firm that may make a hostile bid, jumped 12.2 percent to $48.25.

Clashes continued in Egypt, adding to concern that has pressured equities recently.

Merck & Co fell 2.7 percent to $32.90 and was the top drag on the Dow after the drugmaker forecast 2011 earnings below Wall Street forecasts and withdrew its longer-term profit view.

Trading volume was 7.69 billion shares on the New York Stock Exchange, the American Stock Exchange and Nasdaq, down from last year's estimated daily average of 8.47 billion shares.

Advancing stocks outnumbered declining ones on the NYSE by almost 5 to 4. On the Nasdaq, decliners came in marginally ahead of be advancers.

(Editing by Kenneth Barry)