U.S. stocks rose for a third day Friday, ending the week up as energy shares rebounded with oil prices and data showing surprisingly robust December retail sales underscored optimism about economic growth.

The Dow Jones industrial average rose 41.10 points, or 0.33 percent, to end at 12,556.08. The Standard & Poor's 500 Indexwas up 6.91 points, or 0.49 percent, at 1,430.73. The Nasdaq Composite Index was up 17.97 points, or 0.72 percent, at 2,502.82.

Click here to visit FOXBusiness.com's Investing Center.

The Dow Jones industrial average hit another record high close, its 24th since October, while the Nasdaq posted a fresh six-year high and saw its best weekly percentage gain since mid-September.

Investors bet again that technology shares would outperform this year, and the Nasdaq led gains for the week. Shares of Microsoft Corp. (MSFT), which is releasing its new Windows Vista software, were the top positive on the index for a second straight day.

"Tech returns haven't been as great, relative to other sectors, so some people would consider it somewhat undervalued," said John O'Brien, senior vice president at MKM Partners LLC in Cleveland.

Energy stocks were the biggest gainers on the S&P 500 as U.S. crude futures rose 2.1 percent to $52.99 a barrel, reversing a recent drop to 19-month lows.

Trading volume on the New York Stock Exchange was moderate ahead of the long weekend. All U.S. markets will be closed on Monday in observance of the Martin Luther King Jr. holiday.

For the week, the Dow rose 1.3 percent, the S&P 500 gained 1.5 percent and the Nasdaq advanced 2.8 percent.

A Commerce Department report showed stronger-than-expected December retail sales in what analysts said was a sign of economic resilience.

"It's clear investors are becoming more optimistic about the outlook for the economy," said Hugh Johnson, chief investment officer of Johnson Illington Advisors in Albany, New York.

Oil prices bounced back on concern producer group OPEC would deepen its supply cuts. Prices ended Thursday down 15 percent from the start of the year.

ConocoPhillips (COP), the No. 3 U.S oil producer, gained 3.3 percent, or $2.01, to $63.83, and oil field services provider Schlumberger Ltd. was up 2.4 percent, or $1.37, at $57.89 on the NYSE.

Shares of Microsoft rose 1.7 percent, or 51 cents, to end at $31.21, hitting their highest level since March 2002. The software giant is seen as a safe haven among larger capitalization software stocks after German business software maker SAP AG's warning, analysts said.

The market shrugged off a warning late Thursday from chip maker Advanced Micro Devices Inc. (AMD) that quarterly revenue would fall short of analysts' estimates. Advanced Micro shares dropped 9.5 percent, or $1.92, to $18.26.

Also on the Nasdaq, shares of Comcast Corp. rose 2.7 percent, or $1.14, to $44.09 after Merrill Lynch raised its price target on the cable television service provider.

On the New York Stock Exchange, about 1.53 billion shares changed hands, below last year's estimated daily average of 1.84 billion, while on Nasdaq, about 2.17 billion shares traded, above last year's daily average of 2.02 billion.

Advancing stocks outnumbered declining ones by a ratio of about 2 to 1 on the NYSE and by 19 to 11 on Nasdaq.

Click here to visit FOXBusiness.com's Investing Center.