The price rose above $78 a barrel after an Iranian Revolutionary Guards commander said he was ready to prevent regional crude exports if Iranian oil sales were banned by the United States.

The most-active Brent futures contract for September delivery settled up 48 cents at $78.24 per barrel. U.S. crude futures were up 19 cents at $74.33 a barrel, within sight of Tuesday's 3-1/2-year high above $75 a barrel. The U.S. market will not have a settlement price due to the U.S. Independence Day holiday.

Iranian President Hassan Rouhani appeared on Tuesday to threaten to disrupt oil shipments from neighbouring states if Washington continued to press all countries to stop buying Iranian oil.

Looming U.S. sanctions on Iranian crude exports, force majeure in Libya and unplanned pipeline outages in Nigeria have been clouding the supply outlook despite rising output by the Organisation of the Petroleum Exporting Countries.

"In an ideal world an increase in global or regional oil production would have downward pressure on prices. These are, however, no normal times as supply outages are almost weekly occurrences," PVM Oil Associates strategist Tamas Varga said.

"Under these circumstances it is justified to argue for higher prices when production increases are announced," he said.

Crude inventories fell by 4.5 million barrels in the week to June 29 to 416.9 million, compared with analysts' expectations for a decrease of 3.5 million barrels. Crude stocks at the Cushing, Oklahoma, delivery hub fell by 2.6 million barrels, API said. Crude stockpiles at oil storage facilities in Cushing have dropped after an outage at Syncrude Canada's 360,000 barrels per day (bpd) oil sands facility near Fort McMurray, Alberta.

Trading had been expected to be limited on Wednesday by the U.S. national holiday, although the market has been more volatile.

Implied options volatility, a way of measuring uncertainty among crude oil traders and investors, is at its highest since the run-up to last month's OPEC meeting where an agreement was reached to ease output curbs in place since January 2017.

With the outlook unclear, investors were turning to options to protect themselves against any sudden move, said Harry Tchilinguirian, head of commodities strategy at BNP Paribas.

"When there is consolidation in the market, there is also the expectation of an eventual price breakout in either direction. So in the options market, the volatility gets bid up," he told the Reuters Global Oil Forum.

Investors can bet on various aspects of an option, from the premium to the price to how much that option might move.

(Additional reporting by Henning Gloystein in Singapore; Editing by Edmund Blair and Chris Reese)

By Marcy Nicholson and Amanda Cooper