Front month U.S. West Texas Intermediate crude futures settled 29 cents higher at $53.83 a barrel. For the week, the contract was up about 1 percent.
Brent crude futures were up 24 cents at $56.80 a barrel by 2:34 p.m. ET (1934 GMT). Brent was on track to gain about 2 percent on the week, its first significant weekly rise this year.
Volume in U.S. crude futures was relatively low on Friday, with about 335,000 contracts changing hands by 12:15 p.m., on track to fall short of the 200-day moving average for 528,000 contracts.
This is the first move by the administration of President Donald Trump against Iran. It follows his vows during the 2016 campaign to get tough on Tehran.
Under the sanctions, announced by the U.S. Treasury, 13 individuals and 12 entities cannot access the U.S. financial system or deal with U.S. companies.
A senior U.S. administration said Friday's sanctions were an "initial step" in response to Iran's "provocative behavior," suggesting more could follow if Tehran does not curb its ballistic missile program and continues support for Houthi militia in Yemen.
The news added to volatility in what had already been a day of choppy trading. Analysts said the market is torn between promised cuts from the Organization of the Petroleum Exporting Countries and fears over rising U.S. shale oil production.
"While the market is taking these actions in stride so far as unlikely to result in a larger military conflict that would put Persian Gulf crude oil supplies at risk, the odds of that scenario are certainly higher than a week ago," wrote Timothy Evans, energy analyst at Citi Futures in New York.
Trump had warned on Twitter that "Iran is playing with fire" after its missile test.
"The 'trumperament' of the new U.S. president is being tested by Iran and soon maybe also by Russia and China," said Olivier Jakob, managing director of consultancy PetroMatrix. "And that is adding some geopolitical support to crude oil."
Comments by Russian energy minister Alexander Novak that oil producers had cut their output as agreed under a deal with OPEC, also helped to support prices, analysts said.
Novak said that Russian companies might cut oil production more quickly than required by its deal with late last year. He said that 1.4 million barrels per day (bpd) was cut from global oil output last month as part of the deal.
Oilfield services firm Baker Hughes reported U.S. drillers added 17 oil rigs in the last week. The count has been recovering since June and now stands at 583 rigs, compared with 467 rigs last year.
Analysts said oil's advance could run out of steam quickly. PVM Oil Associates noted the market "is sandwiched between supportive OPEC-led output cuts and the bearish impact of a resurgence in U.S. crude production."
The prospect of more oil output from Nigeria and also from other non-OPEC producers such as Brazil also looms.
"Record speculative length threatens to trigger a sharp price fall as unease builds amid the ongoing wait for a conclusive upside breakout," Commerzbank said in a note.