US oil settles down 2 cents, at $50.89 a barrel

oil fracking North Dakota
Andrew Cullen | Reuters

Crude oil prices briefly rose but gave up gains after a weekly count of U.S. oil rigs fell, capping two weeks of increases.

Front-month U.S. crude futures closed down 2 cents, at $50.89 a barrel. It is down more than 4 percent this week and 15 percent in July. The August contract expires on July 21.

Brent crude was slightly higher at $57 a barrel, but off more than 3 percent for the week and about 10 percent for the month. Brent's August contract expired on Thursday.

Oilfield services firm Baker Hughes reported U.S. drillers took seven oil rigs out of fields last week, bringing the total to 638, compared with 1,554 active rigs at this time last year. The prior two weeks' gains were the first in more than seven months.

Oil came under pressure in choppy trading Friday, heading for a third week of losses and feeling pressure from a stronger dollar and expectations of increased exports from Iran.

The dollar headed for its biggest weekly rise since May and traded near a seven-week high against a basket of currencies after being lifted on Thursday by lower U.S. jobless claims.

Read MoreRussia and its oil are likely to be losers in Iran deal

"WTI selling is continuing off of dollar strengthening," Jim Ritterbusch, president at Ritterbusch & Associates in Galena, Illinois, said in a research note.

Iran can add 550,000-650,000 bpd of oil: Pro
Iran can add 550,000-650,000 bpd of oil: Pro   

Iran has started to ship oil to Asia that it had been storing offshore for months after Tehran and six world powers reached an agreement about Tehran's nuclear program on Tuesday, clearing the way for an easing of international sanctions on Iran.

"With the Iran deal, people are aware there is more supply coming so all impetus for a price correction higher has gone," said Hans van Cleef, senior energy economist at ABN Amro in Amsterdam.

Britain's North Sea Buzzard oilfield ramped up after an outage that started on Wednesday night. The outage was supportive to Brent as oil from the field contributes to the calculation of the benchmark's price.

Read More'More pain coming' to oil sector: Energy investor

U.S. RBOB gasoline futures held on to gains on Friday, supported by recent government data showing strong gasoline demand in the United States.

Thursday's news of dropping U.S. jobless claims was supportive to gasoline futures, even as a string of economic data pointing to a firming economy bolster the case for the Federal Reserve to raise interest rates, a move seen as bearish for crude futures as it could curb liquidity.

Even with Friday's strength, gasoline futures were on track to post a more than 5 percent loss for the week, the biggest since mid-March and the fifth consecutive weekly drop.