As U.S. gasoline prices approach a record average of $5 a gallon, fuel costs are rippling through almost every corner of business, with signs emerging that the rising expenses are beginning to alter consumer behavior.

The price of regular gasoline averaged about $4.986 on Friday, up around 22 ½ cents from the prior week and nearly $2-a-gallon higher compared with this time last year, according to AAA. The steady climb in prices comes as the U.S. economy’s recovery from the pandemic has let loose pent-up demand for travel, by road and by air, and with many returning to work commutes.

Prices of gasoline, as well as diesel and jet fuel, continue to face upward pressure for many reasons that are unlikely to go away soon. Oil and fuel production hasn’t increased quickly enough to meet growing global demand, as economies emerge from pandemic-related restrictions. U.S. fuel-making capacity has actually declined due to refinery closures, while U.S. exports have remained strong as the thirst for fuel in other parts of the world leads traders to capitalize on the arbitrage opportunities of sending it abroad.

The results are being widely felt—from the food, automobile and trucking industries, to airlines, retail stores and service stations, and even in the oil-and-gas business itself—with potential political consequences for President Biden and Democrats seeking to maintain their control of Congress in November’s midterm elections.

Record-high gasoline prices threaten to curb some fuel demand, according to analysts, economists and executives. Drivers are now buying fewer gallons on each visit to gas stations, but making more frequent trips to fuel up, they said.

“They want to fill up a certain amount in dollars and it just doesn’t go as far,” said Andrew Clyde, chief executive officer of Arkansas-based fuel retailer Murphy USA Inc.

The fuel price surge is a big factor in overall inflation, which has reached a four-decade high, according to economists. Higher gasoline prices account for about 18% of the 8.3% overall inflation rate in April from the previous year, according to the Labor Department.

Higher gasoline prices tend to reduce consumption as people adjust their driving patterns, economists say. In the short term, a 10% rise in gasoline prices results in a 2% to 3% decline in gasoline consumption, said Lucas Davis, an economist at the University of California, Berkeley.

Airlines are grappling with the highest inflation-adjusted jet fuel prices since January 2009, according to Airlines for America, a trade group. Strong bookings for domestic flights this summer have helped U.S. carriers cover the additional cost by raising fares, executives said, though they remain more cautious about travel demand this coming fall.

Airline fares rose 18.6% between March and April, according to the Labor Department’s consumer-price index, and they are up 33.3% from a year earlier, though they still remain below 2019 levels.

“The driver of airfare increases is almost exclusively jet fuel prices,” Scott Kirby, CEO of United Airlines Holdings Inc., said in an interview last month, noting fuel costs have almost doubled from the same period in 2019.

Food makers said the cost of transporting raw materials from farms and factories to distributors and retailers is up, contributing to higher grocery bills for consumers.

Mondelez International Inc., maker of Oreos and other snacks, said its overall input costs will be up about 10% to 13% this year, with energy prices adding to the cost of transportation, ingredients and packaging.

“It is predominantly related to energy costs and the ripple effect that energy costs have throughout our commodity basket,” Chief Financial Officer Luca Zaramella said on a June 1 conference call. Mondelez doesn’t expect prices to decrease going into 2023, he said.

Strong bookings for domestic flights this summer have helped U.S. airlines cover higher fuel prices by raising fares.

Photo: David Zalubowski/Associated Press

While inflation affects discretionary spending at retailers overall, consumers buying smaller amounts of fuel more frequently could create opportunities for some retailers to grab market share. Shoppers are visiting Costco Wholesale Corp. more often for its discounted gasoline, executives said during the company’s earnings call last month.

“We have a lot more members coming by and topping off their tank,” said

Bob Nelson, Costco’s senior vice president of investor relations. “And those members will come by to buy five or six gallons and then be on their way.”

The auto industry is particularly sensitive to gasoline-price fluctuations because fuel costs are a big factor in purchase decisions. Already, consumer preferences are starting to shift, with more car shoppers giving priority to fuel economy and looking for options that can help them keep their energy bills in check, such as hybrids or fully electric vehicles, analysts and executives said.

Online searches for electric vehicles have climbed 73% since January, according to data from Kelley Blue Book and Autotrader.com Inc. Interest in hybrids among online shoppers rose 25% in that time frame.

Some brands such as Toyota and Kia are reporting strong hybrid and plug-in hybrid sales, and sales of some smaller, more economical models are starting to take off.

Consumers are seeing prices rise sharply for a variety of goods as U.S. inflation remains close to a four-decade high.

Photo: Alisha Jucevic for The Wall Street Journal

Surging diesel prices are raising worries at trucking companies, including concerns that rising shipping costs could reduce demand if construction projects are pushed off and retailers cut short restocking efforts.

“We’re in uncharted territories at this level,” said Dean Croke, principal analyst at DAT Solutions, a trucking-industry marketplace that matches loads to available trucks. “It’s hurting a lot of carriers, and it’s hurting the smaller carriers the most.”

As demand grows during the summer driving season and with no quick fixes for increasing supplies, many analysts predict prices could climb higher. Gasoline prices could reach a national average of $6.20 a gallon by August, JPMorgan Chase estimated.

The prices are becoming a political liability for Mr. Biden, who has limited options to tamp them down. The administration began releasing 180 million barrels of oil from the U.S. Strategic Petroleum Reserve in April, but gasoline prices have kept rising. After Mr. Biden called Saudi Arabia a “pariah” during the election, administration officials have asked the Middle Eastern nation to increase crude production, with limited success.

The administration has also tried cajoling U.S. oil companies into increasing production, but few have chosen to do so, instead sticking to leaner budgets urged by investors.

One of the primary bottlenecks fueling high gasoline prices is a dearth of global fuel-making capacity. Around 3 million barrels a day of global refining capacity closed during the pandemic, including 1 million barrels a day in the U.S., according to JPMorgan Chase.

As a result, U.S. refineries are maxed out, running at 94.2% of their operable capacity last week, the Energy Information Administration said Wednesday.

Meanwhile, fast-rising exports of U.S. gasoline, diesel and crude oil are helping to drain already-low inventories and raise pump prices, analysts said. American refiners and crude-oil dealers have boosted shipments to Latin America, Europe and elsewhere almost to prepandemic levels. Taken together, U.S. exports of crude oil and refined products reached 6.4 million barrels a day in March, up about 26% from the same month last year, according to the EIA.

The beginning of the American summer driving season has been underwhelming compared with prior years, suggesting that higher prices are taking a toll on motorists. According to the EIA, the amount of gasoline supplied—a proxy for fuel demand—is down for this time of year compared with last year and several years before the pandemic.

Even for the oil-and-gas industry, which benefits from high fuel prices, the increase in costs is raising questions about future investments.

Meg O’Neill, chief executive of Woodside Energy Group Ltd. , said energy prices have climbed following years of reduced spending on oil-and-gas production. Still, she added, she is concerned that inflationary pressures could weigh on projects the oil company is evaluating over the next 18 months.

“We need to make sure the near-term commodity prices don’t unduly influence our thinking,” she said.

Write to Collin Eaton at collin.eaton@wsj.com, David Harrison at david.harrison@wsj.com and Doug Cameron at doug.cameron@wsj.com