The market for sand—a key ingredient in fracking—is surging once again as U.S. oil production rebounds, and the rising price of the tiny grains threatens to cut into energy companies’ profits.

Now that crude oil is selling for just less than $50 a barrel, American shale companies have rushed back into the oil patch, and they are using more sand to help supersize their wells. Sand props open underground fissures, which allows oil and gas to escape to the surface.

But the millions of pounds of sand being poured down wells is pushing up sand prices, eroding some of the profits that energy companies have managed to regain since the oil bust ended. Some are concerned sand supplies, diminished during a two-year oil-price downturn, could stall the drilling renaissance.

“Companies are worried about it,” said James West, a managing director at Evercore ISI, an independent investment bank. “I think the threat of a bottleneck, at this point, is probably understated.”

The tightening market has already sent prices marching toward $40 a ton or more, by some estimates, up from $15 to $20 a ton in the second half of 2016. Increasing sand orders are also raising demand for railcars and trucks to transport it from mines in states like Wisconsin to shale fields in Texas and Oklahoma.

Some predict that demand for sand may outstrip supply by next year, creating a shortage that could linger for most of 2018. Tudor, Pickering, Holt & Co. estimates the sector will need 120 million tons of sand by next year, more than double the demand in 2014 at the height of the U.S. drilling boom.

Demand for sand has already returned to pre-bust levels, said George O’Leary, director of oil-field services research at Tudor Pickering, a Houston-based energy investment bank.

Sand accounted for between 5% and 7% of the cost of a well last fall, and Mr. O’Leary expects that percentage to rise as exploration and production companies use more of it this year. He thinks the price of sand could hit $50 a ton before year-end, though that is still below the $60 to $70 a ton being paid in the third quarter of 2014, before the bust really took hold.

In the quest to find efficiencies of scale during the two-year downturn, producers have been drilling megawells, which run underground for more than a mile horizontally, and blasting larger quantities of sand down them to unleash more fossil fuels.

The biggest U.S. shale fields get fracked with about 30% more sand every year, according to Phillip Dunning, a technical adviser at Drillinginfo, which tracks oil-field supply use.

Frack sand use in the Delaware, one of the hottest parts of the Permian Basin in West Texas, has more than tripled since the start of 2012. By the end of 2016, producers put an average 1,919 pounds per foot down wells that measured 5,500 feet, according to Drillinginfo data.

In Louisiana, Chesapeake Energy Corp. recently pumped a record 50.2 million pounds of sand into a horizontal well roughly 1.8 miles long, piquing the interest of some rivals who are now weighing whether they can do the same.

A handful of oil producers, including Pioneer Natural Resources Co., have purchased their own sand mines to insulate themselves from bottlenecks. Pioneer, a prolific driller in the Permian Basin, plans to nearly triple its Texas sand production by the end of 2019.

Pioneer’s sand use has surged 70% since 2013 to 1,700 pounds a foot. The company will test wells this year using 3,000 pounds a foot.

The expense is compounded by the logistics of moving sand from mines to well sites thousands of miles away. Drillers don’t use sand found on a beach. They prefer fine white silica, much of it found in northern Midwest states. Shipping 5 million tons of sand can require 200,000 truck loads, according to a 2013 study by the University of Wisconsin.

Fracking a West Texas well in some sweet spots now takes 10 million pounds of sand, which requires 200 truckloads of the stuff.

David Adams, the head of Halliburton Co. ’s well completion and production division, said sand costs break down into thirds, equally divided into the cost of sand, the cost of rail transport and the cost to truck the sand to the well. He expects a short-term bottleneck because during the protracted downturn, sand-mining companies slowed production and some canceled plans to open new mines.

Many sand producers are ramping back up, but expanding operations take time. U.S. Silica, which is fetching 20% more for its sand today than it did in October, plans to double its mining capacity to more than 20 million tons in 2018.

Halliburton is trying to keep costs for its clients down by investing in its own train depots and storage facilities in major shale basins from Colorado to North Dakota. It also signed a deal with U.S. Silica in January to use its Sandbox trucks, which use a forklift to load and unload containers from a customized chassis in seconds.

Write to Christopher M. Matthews at christopher.matthews@wsj.com and Erin Ailworth at Erin.Ailworth@wsj.com

Corrections & Amplifications

Fracking a West Texas well in some sweet spots now takes 10 million pounds of sand, which requires 200 truckloads of the stuff. An earlier version of this article incorrectly stated that the amount of sand needed to frack a typical well required 200,000 trucks. Also, Evercore ISI is an independent investment bank. The bank was incorrectly described as an energy investment bank in an earlier version of this article. (March 24)