U.S. crude settled 3.6 percent up at $49.21 a barrel on Wednesday as a weaker dollar, fighting in Yemen and speculative buying boosted prices in spite of U.S. inventories building to record highs for an 11th week.
The dollar fell after disappointing U.S. durable goods orders for February. A weaker dollar makes commodities denominated in the greenback cheaper for holders of other currencies, typically boosting demand for such raw materials.
The dollar also fell against the euro after Europe's largest economy Germany reported that its business morale rise for the fifth month in a row in March, hitting the highest since July 2014. In France, business morale peaked at near 3-year highs.
Fighting in Yemen raised concerns about the security of oil shipments from the Middle East. Analysts worry a proxy war might break out on the Arabian peninsula, home to the world's biggest oil fields, if the conflict draws in Saudi Arabia and rival Iran.
Oil prices retreated earlier in the day after the U.S. Energy Information Administration reported that inventories rose 8.2 million barrels last week, hitting 80-year highs for an 11th straight week. Analysts had expected a build of 5.1-million barrels.