By Ryan Dezember

U.S. oil prices notched their largest monthly gains on record in May, recovering a big chunk of the losses caused in March and April when the country went into lockdown to counter the spread of the coronavirus.

All that unburned fuel swamped refineries and storage facilities and sent oil prices into negative territory for the first time. Since the start of May, though, domestic inventories have been drawn down sharply as producers choked back output and drivers returned to the road.

After dipping below $0 for the first time ever, West Texas Intermediate futures ended April at $18.84 a barrel. In May, the U.S. oil benchmark added $16.65, or 88%, to end at $35.49. In both dollar terms and percentage gain, it was the best month for West Texas Intermediate since the futures contract began trading in 1983.

Futures were little changed Monday, with July deliveries losing 0.1% to settle at $35.44 a barrel. Brent crude, the international benchmark, added 1.3% to close at $38.32.

Traders are weighing not just the return of fuel demand and domestic production cuts but also the fraught China-U.S. trade negotiations, civil unrest in the U.S. and whether the Organization of the Petroleum Exporting Countries and allied oil-producing countries will extend their April curtailment pact.

Saudi Arabia-led OPEC and its market allies, including Russia, are scheduled to hold a videoconference on Thursday to talk about extending their coordinated output cuts.

"The Saudis want to keep production cuts in place for the remainder of summer, but as the rest of the world reopens, someone is going to want to grab that demand," said Edward Moya, senior market analyst for trading firm Oanda.

From the pandemic's onset, gasoline consumption plunged 48% to the lowest levels in at least 30 years. Demand has climbed about halfway back as shelter-in-place policies were eased around the country. During the week ended May 22, daily consumption of gasoline was about 7.3 million barrels, 16% lower than the same time a year earlier, according to U.S. Energy Information Administration data.

Meanwhile, U.S. oil companies have choked back their output and shut in wells in response to prices that had fallen below the cost of production. Daily output during the week ended May 22 was 11.4 million barrels, down from a record of 13.1 million in mid-March.

The cuts might not get much deeper. BofA Securities analysts estimate that the volume of shut-in production peaked last month at 2.5 million barrels a day in the U.S. and Canada.

"Since many of these plans were unveiled, oil prices have strengthened to levels where shutting-in no longer makes sense and should actually encourage producers to quickly restore production," the analysts wrote Monday in a note to clients. "We expect June curtailments, particularly in the U.S., to be a fraction of the previously announced levels."

Still, they and other analysts expect that the sharp budget cuts announced by oil companies will remain largely intact and will lead to a decline in production as fewer wells are drilled to replace naturally declining output of shale wells.

That should help reduce the surplus of oil in storage that builds up during the first half of the year, said Deutsche Bank AG analyst Michael Hsueh, who boosted his forecast for year-end U.S. oil prices to $37 a barrel, up from $32. For Brent, the price that many exported barrels fetch, Mr. Hsueh now expects $40 at the end of the year, up from his earlier prediction of $35.

Write to Ryan Dezember at ryan.dezember@wsj.com