US gasoline futures were the biggest percentage gainer in the petroleum complex, up 1.7 percent to their highest since May 24.
"It's the summer driving season, so the market looks to gasoline for direction and with gasoline performing well, the whole market got an uplift," said Kyle Cooper, consultant at ION Energy in Houston.
Benchmark Brent futures rose 52 cents, or 1 percent, to settle at $51.49 a barrel, while US West Texas Intermediate (WTI) crude gained 29 cents, or 0.6 percent, to settle at $49.04.
That was the highest settlement for both contracts since May 30, putting them into technically oversold territory near their 200-day moving averages, which traders called a point of technical resistance.
"Current bullish momentum is being driven by an array of supportive items that include a supportive outcome to last Monday's OPEC meeting" and continued declines in US inventories, Jim Ritterbusch, president of Chicago-based energy advisory firm Ritterbusch & Associates, said in a note.
Marathon Petroleum Corp CEO Gary Heminger said the company processed a record 1.9 million barrels per day of crude oil at its seven US refineries in the second quarter, fueled in part by robust refined product exports.
On Wednesday, the US Energy Information Administration reported a 7.2 million barrel drop in US inventories in the week to July 21, much more than the 2.6 million barrels forecast.
Saudi Arabia said this week it planned to limit crude exports to 6.6 million barrels per day (bpd) in August, about 1 million bpd below the level last year.
Kuwait and United Arab Emirates, fellow members of the Organization of the Petroleum Exporting Countries, have also promised export cuts.
US shale producers including Hess Corp, Anadarko Petroleum and Whiting Petroleum announced plans this week to cut spending this year.
Some analysts doubted whether shale drilling would slow for long.
"Recent evidence of a slowdown in US upstream activity has been exaggerated and will if anything be transitory," Stephen Brennock at oil brokerage PVM said.
US fuel exports are on track to hit another record in 2017.
Royal Dutch Shell, France's Total and Norway's Statoil reported sharp rises in cash flow from second quarter operations.
Profits for the three companies beat analyst expectations.