Southern Co., the third-largest U.S. utility owner, agreed to buy natural-gas distributor AGL Resources Inc. for $8 billion in cash to capitalize on growing demand for the heating and power plant fuel.

There has been middle-market deal activity in the natural gas sector this year. New York private equity firm Pine Brook is investing $300 million to Red Bluff Resources Holdings LLC, which will focus on buying and developing onshore crude oil and natural gas reserves in the Midwest as well as well as the Permian basin. The PE firm is also investing $100 million to create Cahill Services LLC, which will provide specialty rental services to oil and energy companies.

AGL Resources’ shareholders will receive $66 for each share they own, the Atlanta-based companies said in a joint statement Monday. That represents a 38 percent premium to the Aug. 21 closing price.

The transaction is the largest on record for Southern, which has been increasing the use of gas while reducing coal used to supply its 4.5 million electricity customers in four southeastern states. Southern joins other electric utilities such as NextEra Energy Inc., Eversource Energy and DTE Energy Co. that have formed ventures to build pipelines as growth in power slows and a glut of cheap gas boosts volumes for distributors.

“Coal is out, gas is in,” Skip Aylesworth, a Boston-based manager for Hennessy Funds, said in a phone interview. “If I’m going to convert my power plants to gas to survive as a utility, I want to control the infrastructure to get it to me.”

Hennessy has $2 billion under management including shares of AGL.

Southern owns electric utilities in Georgia, Alabama, Florida and Mississippi and is one of the nation’s largest power generators, according to data compiled by Bloomberg. AGL owns gas utilities with 4.5 million customers in seven states.

The deal is expected to close in the second half of 2016, subject to approval of shareholders of AGL as well as state and federal regulators, the companies said. The transaction will increase Southern’s earnings per share the first year after closing.

Slower Sales

“The addition of AGL Resources to our business will better position Southern Co. to play offense supporting America’s energy future through additional natural gas infrastructure,” Chief Executive Officer Thomas Fanning said in the statement. “For some time we have expressed the desire to explore opportunities to participate in natural gas infrastructure development.”

Electric utilities like Southern’s have reported slower growth in sales amid energy conservation as demand for gas has been rising. Southern’s power sales volumes have risen an average of 1.2 percent annually over the past five years, according to company data compiled by Bloomberg. Gas revenue at AGL rose 37 percent since 2011, when it acquired Nicor Inc., another distributor.

The acquisition would give Southern a 5 percent stake in the $5 billion Atlantic Coast Pipeline under development by electric utility owners Dominion Resources Inc. and Duke Energy Corp. The line would deliver fuel from the largest U.S. gas field, the Marcellus Shale, to eastern Virginia and North Carolina.

AGL gained 30 percent to $62.02 at 8:51 a.m. in New York before the start of regular trading. Southern fell 3.2 percent to $44.32.

Citigroup Inc. was Southern Co.’s financial adviser. Goldman Sachs Group Inc. advised AGL

--Demitri Diakantonis contribute to this report