US light crude at 17:00 GMT was up 62 cents at $39.60 a barrel on Wednesday and US petrol set a new all-time high of $1.315 a gallon.
In London, Brent crude rose 74 cents to $36.67 a barrel, its highest since October 1990, shortly after Iraq's invasion of Kuwait.
"Violence in the Middle East specifically targeting oil assets has raised the bar with regards to the fear of supply disruption," said Josh Sadler, energy analyst with Societe Generale.
An attack on Saturday by Islamist guerrillas on foreign workers at a petrochemical plant in the Saudi Red Sea city of Yanbu followed a failed bombing mission 10 days ago at Iraq's Basra oil export terminal.
"Saudi Arabia's oil infrastructure has three major export arteries and looks as defensive as it could be to attack.
However the risks have clearly risen," said oil analysts at Deutsche Bank in a report.
Weekly petroleum inventory data from the United States at first sight appeared to provide some comfort for dealers worried about a summer supply crunch at US pumps.
The US Energy Information Administration said petrol stocks rose four million barrels to 204 million barrels in the week to 30 April, above forecasts for a 1.5-million-barrel stock-build.
But dealers said they remained worried that inventories may not build sufficiently to meet peak summer US demand.
US demand for motor fuel is rising fast, buoyed by motorists favouring low mileage-per-gallon four-wheel drive (sports utility) vehicles. The EIA said consumption over the last four weeks averaged 9.1 million bpd, up 3.8% over the same period last year.
US inventories remain 3.3 million barrels lower than a year ago and total US commercial oil reserves of 299 million barrels are at an 18-million-barrel deficit versus the same time last year.