Oil prices reversed their losses in post-settlement trade after API data showed a bigger-than-expected draw on inventory.
U.S. crude stocks fell sharply last week, including a large draw at the U.S. hub in Cushing, Oklahoma, while gasoline and distillate inventories dropped, the industry group American Petroleum Institute said.
U.S. oil for August delivery traded up 28 cents at $50.24 a barrel 4:35 EDT, while Brent crude for August delivery traded up 35 cents at $50.95 a barrel.
Before the data was released, oil dipped on more speculation over Britain's future in the European Union, then pared losses to settle off session lows as a U.S. refinery outage triggered a rebound in gasoline prices.
Royal Dutch Shell shut its gasoline-producing fluidic catalytic cracking unit at the 316,600 barrel per day (bpd) Deer Park, Texas refinery. Gasoline futures, which had been down, rebounded into positive territory.
Crude futures pared losses as gasoline rebounded. Oil had dropped as much as 2 percent earlier as investors took profits on a two-day rally fed by speculation that Britain would not leave the European Union after a referendum this Thursday.