Oil prices edged lower in choppy end-year trading on Friday, but were set to post a third straight yearly gain, with Brent closing out 2011 up more than 13 percent and U.S. crude up 9 percent.

Europe's debt crisis and slowing Chinese factories thwarted moves higher while geopolitical tensions and potential threats to supply were supportive.

Light holiday-week trading volumes allowed for sharp price moves and Iran's navy drill in the Strait of Hormuz, along with internal tensions in Iraq, Syria and Nigeria, helped limit losses even after U.S. government data showed crude oil and distillate stocks rose last week.

Brent crude is poised to close 2011 at a record-high average of around $111 a barrel, surpassing the previous annual peak of just below $100 reached in 2008. With the exception of 2008, oil prices have closed higher every year for the last decade.

Brent February crude fell 24 cents to $107.77 a barrel by 1:17 p.m. (1817 GMT) on the final trading day of 2011, having swung from $106.62 to $108.25.

U.S. February crude was down 10 cents at $99.55 a barrel, after falling to $98.61, then recovering and seesawing.

U.S. crude trading volume was 66 percent below the 30-day average, with Brent turnover 59 percent under the 30-day average.

Brent's premium to its U.S. counterpart was little changed near $8.30 a barrel.

Expiring January U.S. gasoline and heating oil contracts added to the trading volatility.

Despite a mild start to the U.S. winter heating fuel season, broker said heating oil, the distillate benchmark, received support from the credit struggles of Europe's largest independent oil refiner Petroplus
.

Petroplus is to close three of its five oil refineries because it has run out of money for crude supplies since bankers abruptly froze credit lines this week.

China's factory activity shrank again in December as demand at home and abroad slackened, the HSBC Purchasing Manager's Index showed. The survey is designed to preview the state of industry ahead of publication of official data.

Iran will fire long-range missiles during a naval drill in the Gulf on Saturday, a semi-official news agency reported. Iran has threatened to close the Strait of Hormuz if the West imposes sanctions on its oil exports.

The euro edged up against the dollar on Friday, after Spain announced a slew of measures to control its finances, but analysts expect the region's debt crisis to continue to pressure the single currency in 2012.

U.S. stocks edged lower as investors waited for next year to begin making large bets, with the S&P 500 on track for a slight gain for the year after returning to positive territory on Thursday.

(Additional reporting by Emma Farge in London and Randy Fabi in Singapore; Editing by Marguerita Choy and Andrea Evans)