Oil extended losses below $78 a barrel on Wednesday after U.S. industry data showed a surprise jump in crude and gasoline stocks, and investors looked to government figures later in the day for confirmation.

The International Energy Agency (IEA) added to the bearish mood by forecasting that supplies will be comfortable for the next five years.

At 1137 GMT, U.S. crude for August delivery slid 20 cents to $77.75 a barrel, extending declines into a second day.

ICE Brent crude futures for August fell 12 cents to $77.92 a barrel.

The American Petroleum Institute (API) trade group said U.S. crude stocks rose by 3.7 million barrels last week, contrary to analysts' expectations for a drop of 800,000 barrels.

Gasoline stocks also rose by 810,000 barrels, even though demand generally peaks in the summer months as motorists in the world's largest energy consumer take to the roads on holiday. Analysts had predicted a 100,000 barrel draw.

Driving season bulls have to acknowledge that inventories are not likely to reach critically low levels, said Tim Evans, an energy analyst at Citi Futures Perspective, adding that U.S. gasoline demand is at its lowest level for this time of year since 2004.

Later on Wednesday, traders will be watching the release of the U.S. Energy Information Administration's (EIA) weekly snapshot of oil and product inventories to see if the government data provides a more definitive picture of demand.

MEDIUM-TERM OUTLOOK

While world oil demand is now expected to grow by an average of 1.2 million barrels per day (bpd) between now and 2015, the IEA said on Wednesday in its annual medium-term oil and gas report that global supply would largely keep pace.

For the next few years, the oil market is marked by more comfortable spare capacity than envisaged last year, and the duration of the current gas glut is set to last beyond 2013, at least in some regions. Yet, we shouldn't be complacent, the Paris-based IEA said.

Global oil production capacity is seen hitting 96.5 million bpd by 2015 from 91 million bpd currently, but potential delays to new deepwater oil projects following the accident at BP's

oil rig in the U.S. Gulf of Mexico may tighten supplies.

On Tuesday, a U.S. judge blocked the Obama administration's six-month ban on deepwater drilling imposed in the wake of BP Plc's Gulf of Mexico oil spill, but the White House said it would appeal against the ruling.

Tuesday's weaker-than-expected housing data in the United States also weighed on prices, analysts said. Existing U.S. home sales were down by 2.2 percent in May, raising fears about the pace of the economic recovery.

If the stock market is going down, it is a factor to drive the crude market lower, said Ken Hasegawa, a commodity derivatives manager at brokerage Newedge in Japan. People continued profit-taking after the API stock build.

Prices of U.S. crude have gained less than 0.5 percent this week after briefly jumping toward $79 on Monday.

They have recovered about 20 percent from a trough below $65 a barrel a month ago but are still about $10 lower than the 19-month peak above $87 a barrel hit in early May, before the onset of the European debt crisis.

(Additional reporting by Alejandro Barbajosa; editing by Keiron Henderson)