* Nearly a quarter of U.S. refining capacity out
* Major gasoline, diesel fuel pipelines closed
* Gasoline futures up a fifth since storm began (Adds quote, details on restarts)
HOUSTON/NEW YORK, Aug 30 (Reuters) - Tropical Storm Harvey further damaged the heart of the U.S. energy industry on Wednesday, churning into Louisiana after flooding the biggest U.S. refinery in Texas, forcing major pipelines to halt operations and threatening a supply squeeze for weeks.
Benchmark U.S. gasoline prices and margins <RBc1-Clc1> surged to two-year highs as Colonial Pipeline, the biggest U.S. fuel system, said it would shut its main lines to the Northeast by Thursday, hit by outages at pumping points and lack of supplies from refiners.
At least two East Coast refineries have already run out of gasoline for immediate delivery as they scrambled to fill barges to markets typically supplied by the Gulf Coast, two refinery sources said. Others were seen running at higher rates to boost profitability by filling shortages.
The Gulf makes up nearly half of total refining capacity in the United States, the world's largest net exporter of refined petroleum products, so the disaster's effects are starting to ripple through global flows. (Graphic: http://tmsnrt.rs/2xzsKWz)
Traders in Europe and Asia were scrambling to reroute cargoes to the United States and Latin America to fill the gap left by refining and shipping closures in the Gulf, but supplies may not arrive fast enough to avert a crunch.
"The longer the Gulf refinery outages last, the wider ranging the ripple effect for regions outside of the U.S. Gulf will be," said Michael Tran, director of global energy strategy at RBC Capital Markets.
Refinery damage from Harvey has driven up gasoline futures prices nearly a fifth over the past week, and pump prices are rising too, particularly in the U.S. South. More refineries could close now that Harvey has made landfall in Louisiana, where refiners can produce 3.3 million barrels per day.
The outages and limited supplies have hit wholesalers. The premium for Chicago-area gasoline above benchmark futures is at its highest since June 2016, while the Gulf Coast price is at its widest above futures since August 2012.
The Explorer Pipeline, which has a capacity of 660,000 barrels a day (bpd), said it shut its main fuel line from Houston to Tulsa, Oklahoma as supplies dwindled.
About 4.4 million barrels of U.S. refining capacity have been shut by Harvey, company reports and Reuters estimates show. That is about 24 percent of U.S. refining capacity and almost equal to Japan's daily consumption.
The figure includes the biggest U.S. refinery, Motiva's Port Arthur facility, which can handle more than 600,000 barrels a day. Parts of the refinery were flooded after more than a foot of rain.
Other Port Arthur refineries also shut overnight, including Total's plant, where sources familiar with operations said they expected water to recede by the weekend.
"The refineries shut down as a precaution might be able to restart," said Antoine Halff, director of Global Oil Markets at the Center on Global Energy Policy at Columbia University.
"The others in a worst-case scenario could take weeks and months to repair."
More rain fell on the area on Tuesday night than elsewhere in the region since the storm roared in last week, said David Roth of the U.S. Weather Prediction Center.
Refiners further south on the Texas coast, including Citgo's Corpus Christi refinery, expected to restart by the weekend.
But damage delayed a restart of the gasoline unit at Marathon's 459,000-bpd Galveston Bay refinery, plant sources said. Citgo's 425,000 bpd Lake Charles refinery, on the Louisiana coast in the storm's path, halved capacity.
Restarts after a storm are especially dangerous for refiners, though far less rain fell in Corpus Christi than in Houston.
"The continued increase in flooding creates high uncertainty on the amount of damage that U.S. refineries will incur, the pace at which the shutdown will reverse and the magnitude of capacity impaired over the next few months," Goldman Sachs analysts wrote in a note.
They expected about a tenth of what is now offline to stay shut for several months, they added.
Just last week, refiners pushed output to their highest percentage of capacity since 2005, as gasoline demand hit an all-time weekly record of 9.85 million barrels, U.S. Energy Department data showed on Wednesday.
Gasoline futures gained 7 percent on Wednesday alone. Refinery shutdowns and fuel shortage worries have also boosted retail fuel prices, particularly in the U.S. south and southwest.
The AAA said retail gasoline prices were up 6 cents from a week ago at $2.404 per gallon of regular gasoline nationwide. They have risen as much as 12 cents in some states, like Georgia.
The storm has also sharply cut shale production in the Eagle Ford region of Texas.
(Reporting by Erwin Seba and Devika Krishna Kumar; additional reporting by Catherine Ngai, Julia Simon and Jarrett Renshaw, writing by David Gaffen; Editing by David Gregorio and Clarence Fernandez)