Crude futures closed up 1 percent on Tuesday, latching onto a rebound in oil products ahead of U.S. inventory data expected to show strong demand for gasoline.
Also supporting prices were signs of trouble with an impending Iranian nuclear deal that could delay Tehran's hopes of lifting Western sanctions on its oil exports.
A strong dollar, which usually pressures commodity prices, did little to temper the rally.
Read MoreTrading energy's unhappy anniversary
Gasoline futures surged almost 3 percent, holding above the 50-day moving average. They briefly fell below that level on Monday for the first time since February after a sell-off in recent sessions.
"All of the action remains in products," said Scott Shelton, a crude broker with ICAP in Durham, North Carolina.
The oil products markets have been extraordinarily strong since the start of the peak U.S. driving season at the end of May, which typically translates to higher demand for fuels.
U.S. gasoline inventories were seen to have fallen 400,000 barrels last week, a Reuters poll showed ahead of official inventory data due on Wednesday.
Ultra-low sulfur diesel (ULSD) also rallied nearly 3 percent despite indications that stockpiles of distillates, including diesel, rose last week.
The products rally bumped up the "crack," or profit margin, refiners derive from processing crude into gasoline and diesel, after a recent slump in such margins.
U.S. commercial crude oil stocks were also expected to have fallen for an eighth straight week, the poll indicated.
"I'm guessing people who were short the ULSD and gasoline cracks the past few days took some profit to push those markets higher. Technical and buy-stop orders were probably activated in the process," said David Thompson, executive vice-president at Powerhouse, an energy-specialized commodities brokerage in Washington.
The Reuters poll suggested that U.S. commercial crude oil stocks had fallen for an eighth straight week, lending further strength to the crude rally.
Read MoreIs big energy busting its own model?
Ahead of the government data, industry estimates on last week's supply-demand in oil will be released by the American Petroleum Institute at 4:30 p.m. EDT (2030 GMT).
In Iran, the parliament passed a bill banning access for U.N. inspectors to its military sites and scientists.
A crude broker in New York said the bill was "an indication that Iran may be running into some difficulties" in meeting a self-imposed June 30 deadline on a nuclear accord with world powers to resume crude exports.