NEW YORK (Reuters) - Oil prices surged on Friday, and Brent crude posted its largest weekly gain since mid May, as investors positioned for the start of third quarter trading while a weaker dollar boosted prices of most commodities.

A worker grabs a nozzle at a petrol station in Tehran, Iran January 25, 2016. REUTERS/Raheb Homavandi/TIMA

The market shook off a closely-followed industry report that showed a fourth weekly rise in the last five in the number of U.S. oil rigs operating. According to oil services firm Baker Hughes, producers added 11 oil rigs this week, the biggest increase since December, signalling a near-two year rout in drilling may have ended. [RIG/U]

“Higher rigs indicate higher production, but we’re still down by more than 300 rigs from a year ago, so no one’s really too worried about it for now,” said Phil Flynn, analyst at the Price Futures Group brokerage in Chicago.

Brent crude futures settled up 64 cents, or 1.3 percent, at $50.35 a barrel. It was down 1 percent early in the session.

U.S. crude’s West Texas Intermediate (WTI) futures rose 66 cents, or 1.4 percent, to settle at $48.99.

Investors also bought oil after cashing out in the previous session on the market’s largest quarterly gain in seven years. Crude prices gained about 25 percent in the second quarter.

Friday’s rebound came as the dollar index fell 0.5 percent, making commodities denominated in the greenback more affordable for holders of the euro and other currencies. [FRX/]

Brent’s 4 percent rise since last Friday was the biggest in seven weeks, and was fed by a return of fund buying as the turmoil sparked by Britain’s shock exit from the European Union receded. WTI gained nearly 3 percent on the week.

Front-month volume in WTI was about three-quarters of Thursday’s level, not typical for the eve of a long weekend. U.S. financial and commodity markets will be closed on Monday for the Independence Day holiday.

“There is some pre-holiday market positioning for the second half that’s going on,” said David Thompson, executive vice-president at Washington-based commodities-focused broker Powerhouse. “People are also moving on from Brexit, accepting they have to deal with an ‘organized divorce’ with Britain.”

Even so, some were pessimistic of significant price gains in the second half.

British bank Barclays, for instance, cut its price forecasts by $3 a barrel for both oil benchmarks, forecasting Brent at $44 and WTI at $43 for the remainder of 2016.

“Markets have experienced only the tip of the iceberg in terms of the impact of the UK’s ‘leave’ vote,” Barclays analysts said in a note.