Oneok Inc. agreed to buy Magellan Midstream Partners LP in a $18.8 billion cash-and-stock transaction that would create one of the U.S.’s largest oil and natural gas pipeline operators.

The deal will see each Magellan stakeholder receive $25 in cash and 0.6670 shares of Oneok stock per unit, representing a 22 percent premium to closing prices on May 12, the companies said in a joint statement. The transaction includes $8.8 billion in new equity and the assumption of $5 billion of existing net debt.

Pipeline operators are increasingly turning to mergers and acquisitions for growth as the transition to renewable energy pares the need for new links and threatens to make some of their existing assets redundant. The acquisition will give Oneok, which currently transports only natural gas and its byproducts, access to a network of crude oil and refined products conduits and terminals sprawling from Texas to Minnesota.

The combined company will have a total enterprise value of $60 billion, according to the statement. That would put it among the five largest U.S. pipeline operators by that criteria, according to data compiled by Bloomberg.

“We see this as a bold move to redirect the long-term strategy of both companies, propelling the pro forma entity closer to the top of the class from a scale and diversification perspective,” Raymond James Financial Inc. analysts J.R. Weston and Justin Jenkins said in a note to clients. While the “surprising deal” comes at a high price for Oneok shareholders, it could still make sense, they said. “We are fans of consolidation in midstream.”

The transaction is expected to close in the third quarter, subject to shareholders and regulatory approvals. Oneok has secured $5.25 billion in fully committed bridge financing for the proposed cash consideration.

Oneok expects the transaction to have a positive impact both on an earnings per share and a free cash flow per share basis, with scale gains of at least $200 million a year.

Both Oneok and Magellan are based in Tulsa, Oklahoma.