* U.S. gasoline at two-year high above $2 a gallon
* Almost a quarter of U.S. refineries shut due to Harvey
* WTI on track for steepest monthly loss in over a year
* Storm impact to hit crude throughput, boost inventories
* Harvey's energy impact interactive: http://tmsnrt.rs/2xzsKWz (Updates throughout)
AMSTERDAM, Aug 31 (Reuters) - U.S. crude oil prices are on track to post the steepest monthly losses in more than a year on Thursday as concerns spread over falling demand in the world's top oil-consuming country after storm Harvey knocked out almost a quarter of its refineries.
But prices rallied in the oil products markets, with U.S. gasoline futures hitting a two-year high above $2 a gallon, buoyed by fears of a fuel shortage just days ahead of the Labor Day weekend that typically sees a surge in driving.
Harvey, which brought record flooding to the U.S. oil heartland of Texas and killed at least 35 people, has paralysed at least 4.4 million barrels per day (bpd) of refining capacity, according to company reports and Reuters estimates.
The country's biggest fuel transport system, the Colonial Pipeline, also said it would shut its main diesel, jet fuel and gasoline lines because of outages at its supply points.
Traders from Europe to Asia were scrambling to fix fuel cargoes to the United States, with price reporting agency Argus registering a record monthly trade volume of European gasoline barges.
Analysts at Goldman Sachs and Stifel said infrastructure outages could last several months, although it was difficult to estimate the exact damage.
"We still expect production growth to resume, however Harvey probably pushed it out a couple of months or maybe even a quarter," said analysts at Stifel.
Crude markets remained weak after sharp losses in the previous session. The closure of so many U.S. refineries has resulted in a slump in demand for the most important feedstock for the petroleum industry.
U.S. West Texas Intermediate (WTI) crude futures were set to close the month down 8 percent, their steepest monthly loss since July 2016. They traded at $46.09 a barrel at 1201 GMT, up 13 cents on the day, after falling more than 1 percent on Wednesday.
International benchmark Brent crude was at $51.22, up 36 cents from the previous session, when the contract fell more than 2 percent.
"Refineries outside the affected area may delay maintenance to benefit from high processing margins," said Carsten Fritsch, oil analyst at Commerzbank.
"Hence, the negative impact on crude oil demand and oil product supply might be less severe than feared."
U.S. crude and product stocks, typically watched closely by oil investors as they reflect market balancing, were largely ignored this week.
U.S. commercial crude stocks fell by 5.39 million barrels last week to 457.77 million barrels, the U.S. Energy Information Administration said on Wednesday. <C-STK-T-EIA>
That's down 14.5 percent from record levels reached in March.
At the same time, the amount of crude entered into refineries reached a record high of 17.73 million bpd, the data showed, a number that is expected to have dropped dramatically this week due to infrastructure closures.
Analysts at JBC Energy said that figure could slip to as low as 15-16 million bpd.
Others said the refinery closures would lead to a rise in crude inventories.
"We could see rising U.S. crude inventories in the next couple of weeks until demand from refineries recovers. But by the end of September, I expect the situation to be almost back to normal," said Frank Schallenberger, head of commodity research at LBBW.
The trend for shrinking oil stocks and expectations for an uptick in global oil demand growth meant analysts polled on a monthly basis by Reuters raised their oil price forecasts for the first time in six months.
(Additional reporting by Henning Gloystein in Singapore; Editing by Dale Hudson and Mark Potter)