Some investors see fortunes to be made in the U.S.’s hottest oil field—by speculating in water, not crude.

Fledgling companies, many backed by private equity, are rushing to help shale drillers deal with one of their trickiest problems: what to do with the vast volumes of wastewater that are a byproduct of fracking wells.

When producers blast a mix of water, sand and chemicals to release oil and gas from rock formations miles underground, they not only unlock oil and gas, but also massive quantities of briny water long buried beneath the surface. Drillers in the Permian Basin in New Mexico and Texas currently generate more than 1,000 Olympic-size swimming pools full of this murky, salty water every day. Handling it amounts to up to 25% of a well’s lease operating expense, according to analysts.

Investors have expressed interest in this corner of the U.S. shale industry as oil production in the Permian soars to record levels. Analysts said the region could produce more than five million barrels of oil a day by 2023, more than the current daily production of Iran.

Sensing a chance for a big return, private-equity firms have invested more than $500 million into wastewater-disposal companies such as Solaris Water Midstream, WaterBridge Resources LLC, and Oilfield Water Logistics. There are roughly a dozen of these water-focused companies that analysts said could each be worth hundreds of millions of dollars.

These companies are building pipelines to transport the wastewater and dispose of it deep underground, hoping to displace the trucks that currently do the job. Some companies have a longer-term plan: recycling the wastewater to sell it back to drillers to reuse. Most of the companies are currently private; WaterBridge Resources in June announced plans for an initial public offering, and others are expected to follow suit.

“The math on this is really, really easy,” said Christopher Manning, a managing partner of Trilantic Capital Management LP, which has invested in Solaris Water Midstream and committed as much as $100 million to the company. “If the Permian goes up by one million barrels per day in oil production, it’s going up six million barrels in water. That’s an opportunity.”

Larger pools of capital are looking for a way into the game, and Mr. Manning and others expect the companies to attract billions of dollars in investment. KKR & Co., one of the world’s largest private-equity firms, has begun approaching companies in the space in recent months, according to people familiar with the matter. A KKR spokeswoman declined to comment.

Finding a long-term solution to the wastewater problem is essential for Permian producers. A single shale well can produce more than a million of barrels of oil over its lifetime, and many times that amount of water.

Energy analyst IHS Markit has found that in some parts of the Permian Basin, wells produce 10 times as much water as they do hydrocarbons. In the Delaware portion of the Permian, the area’s most popular geologic deposit, water-to-oil ratios conservatively average 5 to 1, analysts said.

For years, drillers have relied on trucks to move the water, but surging U.S. shale production means trucks alone may not be able to handle the growth, a problem exacerbated by the continuing trucking shortage. Moving the water by truck, about 125 barrels at a time, is no longer feasible when a single well produces thousands of barrels a day. And rising water-management costs could add as much as $6 to the cost of producing a barrel of oil, according to IHS, potentially curbing the growth of future Permian oil supply by 400,000 barrels a day by 2025.

Truckers and the new entrants typically dispose of wastewater in underground wells, but the latter group hopes it can provide drillers the service more cheaply using pipelines that are scalable. Outside of Pecos, Texas, WaterBridge is building a network of pipelines to take away wastewater from some of the area’s biggest producers—Occidental Petroleum Corp., Concho Resources Inc., Anadarko Petroleum Corp. and Noble Energy Inc. The company said it would have 125 miles of pipelines built by the end of the year capable of handling 600,000 barrels a day.

“We really don’t know the potential here,” said Jason Long, WaterBridge’s chief commercial officer, during a recent tour of one of the company’s roughly 20 disposal sites on the edge of the Chihuahuan Desert, a compound of steel tanks that process thousands of barrels of water before pumping them into an underground disposal well. “We could sit back in 2020 and have 500 miles of pipe in the ground.”

There are looming regulatory and environmental challenges. Studies have linked disposal wells to earthquakes as wastewater from fracking can put stress on underground faults and increase seismic activity, and some in the industry predict regulators will tamp down on permitting new wells.

Still, producers are signing up for long-term contracts with companies like WaterBridge. That is a shift from what had been a spot market priced by the truck load and a sign that producers need to lock up a solution for their water, said David Capobianco, whose investment firm, Five Point Energy, has pledged $200 million to WaterBridge. Moving water by pipe costs anywhere from 60 cents to $1.50 a barrel compared with more than $2 by truck, said Mr. Capobianco, who previously headed Vulcan Capital, Microsoft Corp. co-founder Paul Allen’s investment firm.

Apache Corp., one of the largest producers in the Permian, wants to reuse more water to reduce the millions of barrels it must dispose of and limit the freshwater it purchases for fracking, according to a company presentation earlier this year. Apache recycled more than 22 million barrels of water from 2013 to 2016 just in one subsection of the Permian.

“Prudent water management is critical to our success. It’s good for communities, it’s good for the environment and it’s good for business,” said Apache spokesman Phil West.

That means a potentially new business opportunity for water-disposal players. Historically, producers have mostly used freshwater for fracking, but water companies are setting up their networks with an eye on treating produced water so it can be reused for fracking and resold to the shale drillers who paid them to take it away in the first place.

“You can flare gas,” said Mr. Capobianco. “You can’t flare water. Once the water stops flowing you have to shut in a well. When we began looking at this sector seven years ago, that was really an epiphany.”