* 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
* Pre-storm U.S. crude throughput at record high - EIA
* Harvey's energy impact interactive: http://tmsnrt.rs/2xzsKWz (Updates throughout, changes dateline, previous SINGAPORE)
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 paralyzed at least 4.4 million barrels per day (bpd) of refining capacity, according to company reports and Reuters estimates.
Traders from Europe to Asia were scrambling to fix fuel cargoes to the United States.
Goldman Sachs said it could take several months to restore all production.
"While no two natural disasters are similar, the precedent of Rita-Katrina would suggest that 10 percent of the ... currently offline capacity could remain unavailable for several months," the investment bank said.
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.12 a barrel at 0849 GMT, up 16 cents on the day, after falling more than 1 percent on Wednesday.
International benchmark Brent crude was at $50.86, unchanged from the previous day, when the contract fell more than 2 percent.
"The temporary closure of refineries is a major dent to United States crude demand and is weighing on both Brent and WTI prices," BMI Research said.
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.
(Additional reporting by Henning Gloystein in Singapore; Editing by Dale Hudson)