US oil settles down 4 cents, or 0.08%, at $52.74 per barrel

Beware, downside risks ahead for oil: ANZ
Beware, downside risks ahead for oil: ANZ   

Crude oil futures closed slightly lower on Friday after data showed the U.S. oil rig count barely rose this week, allaying fears of an acceleration in drilling that could bring on a surfeit of new supply to the market.

U.S. energy firms added five oil rigs this week, despite a 19 percent collapse in U.S. crude prices from a recent high, a sign drillers were ready to return to the well pad.

The gains came after 29 consecutive weeks of declines, bringing the total rig count up to 645, compared with 1,563 at this time last year, Baker Hughes said in its closely followed report.

Read MoreWhy oil could revisit its lows and then some

Brent crude was up 2 cents at $58.62 a barrel by 2:33 p.m. EDT. Brent had settled up more than 3 percent on Thursday, a powerful rebound from Tuesday's three-month lows.

Front-month U.S. crude futures closed 4 cents lower at $52.74 a barrel.

The market was volatile after initially moving up after a rally in Chinese equities in Asian trading overnight and after optimism that Greece may have a bailout deal by the weekend.

But weak gasoline prices, worries about a potential Iranian nuclear deal and the International Energy Agency's (IEA) forecast of weaker oil demand later weighed on the market.

"The prospects on a Greece bailout is encouraging but we're down on anticipation that an Iran deal may also get done," said David Thompson, executive vice-president at Powerhouse, an energy-specialized commodities broker in Washington.

Read MoreBoone Pickens: Why I'm standing by $70 oil by year end

The International Energy Agency (IEA) said on Friday that oil prices are set to come under further pressure from easing global demand and an expanding glut of crude, while a rebalancing of the oil markets may last well into next year.

The IEA, the West's energy watchdog, said it expected global demand growth to slow next year to 1.2 million barrels per day from 1.4 million this year—far less than needed to balance stubbornly growing non-OPEC and OPEC supply.

"Physical oil market fundamentals remain weak and, in the absence of OPEC production cuts or material supply disruption, this is unlikely to change meaningfully," Deutsche Bank said in a note.

Top oil exporter Saudi Arabia continues to keep output and export supply high, maintaining fully contracted volumes to Asia in August.

—CNBC's Tom DiChristopher contributed to this story.