A man carries an umbrella in the rain as he passes the New York Stock Exchange October 16, 2014. REUTERS/Brendan McDermid/Files

By Caroline Valetkevitch

NEW YORK (Reuters) - U.S. stocks extended gains for a third session on Friday, giving the S&P 500 its best weekly performance in nearly two months as energy shares continued to rebound.

The S&P energy index (.SPNY) jumped 3.1 percent, leading the benchmark index's advance, and closed out the week with a 9.7 percent gain, its biggest weekly increase since December 2011.

The benchmark S&P 500 has gained 5 percent over the three sessions, bouncing back quickly from recent losses sparked by a selloff in oil prices.

The key driver of this week's rally was the U.S. Federal Reserve's commitment on Wednesday to take a "patient" approach toward raising interest rates, which relieved investors over the policy outlook.

"Fears have been at least pushed once again to the sidelines," said Michael James, managing director of equity trading at Wedbush Securities in Los Angeles.

The Dow Jones industrial average (.DJI) rose 26.65 points, or 0.15 percent, to 17,804.8, the S&P 500 (.SPX) gained 9.42 points, or 0.46 percent, to 2,070.65 and the Nasdaq Composite (.IXIC) added 16.98 points, or 0.36 percent, to 4,765.38.

For the week, the Dow gained 3 percent, the S&P 500 rose 3.4 percent and the Nasdaq climbed 2.4 percent.

Helping to lift energy shares, Brent crude (LCOc1) rose 3.6 percent at $61.38 a barrel, while WTI crude (CLc1) jumped 4.5 percent to settle at $56.52. Energy shares have recovered in the recent rally even when oil prices continued to fall.

Quadruple witching - the expiration of stock options, index options, index futures and single-stock futures - added to the day's volatility. Volume was high. About 10.9 billion shares changed hands on U.S. exchanges, above the 7.6 billion average this month, according to BATS Global Markets.

"I would expect volatility to continue next week, given the magnitude of the moves both down and back up we've had this week, and because of the holiday and the likelihood there will fewer people to trade," James said.

Shares of Red Hat (RHT.N) surged 10.6 percent to $68.04 after it raised its profit forecast for the full year and reported quarterly revenue and profit above expectations.

On the downside, shares of Nike (NKE.N) shed 2.3 percent to $94.84, a day after the company flagged slowing growth in western Europe.

NYSE advancing issues outnumbered decliners 2,004 to 1,102, for a 1.82-to-1 ratio; on the Nasdaq, 1,420 issues rose and 1,329 fell for a 1.07-to-1 ratio.

The benchmark S&P 500 posted 110 new 52-week highs and 5 new lows; the Nasdaq Composite recorded 131 new highs and 52 new lows.







(Editing by Nick Zieminski)