Power producer Southern Co said it would buy AGL Resources Inc for about $8 billion in cash, making it the No. 2 U.S. utility by customers after Exelon Corp.

The combined company will have generation capacity of about 46 gigawatts and will operate nearly 200,000 miles of electric lines and more than 80,000 miles of gas pipelines.

The deal will form a company with 11 regulated electric and natural gas distribution companies serving about 9 million customers, Southern Co said.

AGL shareholders will receive $66 for every share held, a 38 percent premium to the stock's Aug. 21 close.

Including debt, the deal is valued at about $12 billion.

The deal will add natural gas infrastructure assets to Southern Co's portfolio.

Citigroup Global Markets Inc is Southern Co's financial adviser, while Jones Day, Gibson Dunn & Crutcher LLP and Troutman Sanders LLP are its legal counsel.

Goldman, Sachs & Co is AGL's financial adviser, while Cravath, Swaine & Moore LLP is its legal counsel.