Oil prices edged lower on Sept. 9 but were set for the first weekly gain in three weeks after jumping 4% a day earlier due to a surprisingly large drawdown in U.S. crude stocks.

Brent and West Texas Intermediate crude futures have gained nearly 6% this week and are on course for their biggest weekly gain in three weeks following two consecutive weeks of declines, after major producers Saudi Arabia and Russia agreed on Sept. 5 to cooperate on stabilizing the oil market.

London Brent crude for November delivery was down 52 cents at $49.47 a barrel as of 5:03 a.m. CT (10:03 GMT) after rising above $50 for the first time in two weeks and settling up $2.01, or 4.2%, on Sept. 8.

NYMEX crude for October delivery was down 50 cents at $47.12.

The International Energy Agency has said it sees demand finally exceeding supply in the third quarter of 2016, meaning record crude stockpiles around the world should also start falling.

But analysts from Morgan Stanley said on Sept. 9 they saw risks of supply and demand rebalancing being delayed.

"We are not yet changing our forecast for a mid-2017 rebalancing, but our conviction level is falling," Morgan Stanley said in a note. "Once again, we see an increasing probability for several unexpected bearish developments to come together, which could push off rebalancing [seasonally-adjusted demand exceeding supply] to late 2017 or even 2018."

If OPEC and non-OPEC producers agree to implement measures to limit supply when they meet next month in Algeria, it should help the markets rebalance.

Algeria's oil minister said on Sept. 9 two separate agreements could be required between OPEC and non-OPEC, highlighting the difficulties of clinching such deals.

The oil options market indicates traders are not betting big on OPEC and rival Russia clinching a meaningful deal this month.

Iran's steep oil output growth has stalled in the past three months, new data showed, suggesting Tehran might be struggling to fulfill its plans to raise production to new highs.

Oil prices shot up on Sept. 8 after U.S. government data showed the biggest weekly drop in stockpiles since January 1999. Traders said imports fell as ships delayed offloading cargoes in Texas and Louisiana due to Tropical Storm Hermine.

RELATED:

Saudi Arabia, Russia Sign Oil Pact For Possible Future Output Limit

Report: US Crude Stocks Plunge More Than 14 Million Barrels

Tropical Storm Hermine Shuts In Some GoM Oil, Gas Production