Huge volumes of dirty water produced by U.S. shale firms are driving up investment in water-handling specialists, as cash-conscious oil and gas companies try to trim costs.

HOUSTON, Oct 5 (Reuters) - Huge volumes of dirty water produced by U.S. shale firms are driving up investment in water-handling specialists, as cash-conscious oil and gas companies try to trim costs.

For every barrel of crude, drillers generate up to six barrels of brackish water containing chemicals used to release oil and gas from shale rock. The water is trucked or piped to disposal wells, or recycled.

Transporting and disposing of water is costly for energy producers who are cash-strapped after more than two years of slumping oil prices, and some are opting to sell pipelines and wells to wastewater companies and then pay them to manage water.

Water-handling companies benefit from economies of scale, but convincing energy CEOs to release water operations that they traditionally managed in-house is challenging, as new players build up their expertise.

In the biggest deal this year, water-handling firm Select Energy Services agreed to acquire Rockwater Energy Solutions in a stock deal valued at $516 million.

In the Permian Basin, the country's largest oilfield, the 2.5 million barrels of oil produced daily generates about 15 million barrels of water per day.

"It's just a staggering amount of water," said Joel Fry, a principal at Dallas-based private equity firm Tailwater Capital, which last year committed $80 million to water-handling firm Goodnight Midstream. "The opportunity is absolutely there."

Trucks or pipelines ferry wastewater to sites where it is injected deep underground. In Oklahoma, the state regulator put restrictions on those wells after a 2015 Stanford University study linked them to a spike in Oklahoma earthquakes.

In June, Houston-based H2O Midstream, backed by $100 million from EIV Capital and others, bought 100 miles of pipeline and five disposal wells in West Texas from energy producer Encana Corp and agreed to manage the company's wastewater.

Other private-equity backed deals include WaterBridge Resources' purchase in August of EnWater Solutions, and Goodnight Midstream's purchase this summer of infrastructure in Texas. Purchase prices were not disclosed.

Energy producers have traditionally viewed water simply as waste, not as water handlers see it - a commodity that produces revenue, said Jim Summers, CEO of H2O Midstream.

Frack water handling businesses are similar to the midstream industry that emerged decades ago around gas gathering and crude transport, said Patrick Walker, CEO of Goodnight, which last month agreed to build a pipeline in Texas to move Callon Petroleum Co's wastewater to disposal wells.

Wastewater collectors may have a tough sell to producers in a period of low oil prices, however, one investor said.

"At $45-$50 (per barrel) crude, it may not be a line item in the budget that you need to have," said Libby Toudouze, a portfolio manager at Cushing Asset Management, which holds a stake in NGL Energy Partners LP, a company that provides water services.