Brent crude futures settled up 77 cents or 1.5 percent to $50.97 a barrel. US West Texas Intermediate futures rose 86 cents or 1.8 percent to $48.75 a barrel.
US crude stocks fell last week as refineries hiked output and imports dropped, while gasoline stocks decreased and distillate inventories fell, the Energy Information Administration said.
Crude inventories fell 7.2 million barrels in the week ending July 21, far exceeding the 2.6 million barrel forecast. It was the fourth straight weekly decline, bolstering hopes that the long-oversupplied market was moving toward balance.
On Monday, Saudi Arabia said it would limit oil exports to 6.6 million barrels per day (bpd) in August, down nearly 1 million bpd from a year earlier.
"Today's report has strengthened the bullish sentiment already prevailing in the market, although the longevity of the move remains in doubt," said Abhishek Kumar, Senior Energy Analyst at Interfax Energy's Global Gas Analytics in London. "Nevertheless, the country's crude and gasoline stockpiles remain above their five-year averages, which will cap price gains."
The drawdown was a combination of higher exports from the United States, a marginal decline in oil output and a rise in the refinery utilization rate, he said.
"The market has been tightening and the refinery margins are strong," said PetroMatrix managing director Olivier Jakob, adding the US stock draw offered a boost to prices. "You add geopolitical risk premium for Venezuela, and you've got a strong market."
In Venezuela, an OPEC member producing about 2 million bpd of oil, President Nicolas Maduro's opponents launched a two-day national strike to push him to abandon a weekend election. The United States is considering financial sanctions to halt dollar payments for Venezuelan oil.
Nigerian output slipped this week as leaks forced Shell to shut a pipeline exporting some 180,000 bpd of oil. Nigeria, which has been exempted from OPEC-led production curbs, has agreed to cap or cut output when it stabilized at 1.8 million bpd.
But analysts said rallying oil prices could encourage more production, particularly from the United States.
"Any price rebound will only embolden US shale producers at a time when rumors have started to emerge that the US shale boom is slowing," PVM oil analyst Stephen Brennock said in a note.