Brent crude settled down 66 cents, or 0.8%, to $77.59. During the session it both rose and fell over $1. U.S. West Texas Intermediate crude futures settled down 51 cents, or 0.7%, to $72.19.
Low fuel demand and large inventory increases in data from the U.S. Energy Information Administration weighed on prices.
Gasoline stocks rose by 10.9 million barrels to 237 million barrels, their highest week-on-week rise in more than 30 years.
Distillate stocks rose last week by 10.1 million barrels to 125.9 million barrels. Distillate product supplied, a proxy for demand, fell to its lowest level since 1999, EIA data showed.
"The key Northeast region is still indicating relatively mild temperatures well into the 3rd week of this month in likely limiting diesel gains," said Jim Ritterbusch, president of Ritterbusch and Associates LLC in Galena, Illinois.
While crude inventories drew by 5.5 million barrels in the week, EIA data showed, much of that reflects shipping disruptions in the Red Sea, said Bob Yawger, director of energy futures at Mizuho.
"The situation in the Red Sea has forced a lot of refiners and buyers of crude oil to go to the United States rather than sail their boat around the Horn of Africa," Yawger said.
Shipping concerns lingered after Yemen's Iran-backed Houthis on Wednesday said they had "targeted" a container ship bound for Israel. U.S. Central Command said the militant group had fired two anti-ship ballistic missiles in the southern Red Sea the previous day.
Downbeat economic data sent prices lower earlier in the session. Euro zone business activity shrank in December. German inflation rose, possibly offering the European Central Bank an argument in favour of keeping interest rates steady for some time.
Both oil benchmarks gained about 3% on Wednesday to settle higher for the first time in five days. Oil also found support from American Petroleum Institute data showing crude stocks fell by 7.4 million barrels, double the expected drawdown.
On Wednesday two explosions killed nearly 100 people and wounded scores at a ceremony in Iran to commemorate commander Qassem Soleimani, who was killed by a U.S. drone in 2020. Iran has vowed revenge.