Energy Transfer Equity LP won its bid to take over Williams Cos., agreeing to pay $37.7 billion for control of pipelines and plants that handle almost a third of rising U.S. natural gas demand.

Williams investors will get $43.50 a share either in cash or stock of Energy Transfer Corp. LP, an affiliate of Energy Transfer Equity, according to a statement Monday. Williams canceled its May offer to buy all stock it doesn’t own in its affiliate, Williams Partners LP. The $43.50 a share price represents a 4.6 percent premium to the Williams closing price on Sept. 25.

The deal ends a nine-month effort by Dallas billionaire Kelcy Warren that became public in June when Williams rejected Energy Transfer’s first offer as too low, and then sought other suitors for an auction of the company.

The takeover comes as a record volume of natural gas flows out of the Marcellus shale formation centered in Pennsylvania, now the largest and most prolific U.S. gas field. The surge in output from the region has upended the nation’s gas markets, as well as the majority of the U.S. pipeline network that was previously designed to deliver gas from the Gulf Coast.

“It’s going to be good to control a lot of long-distance pipelines because the pricing is going to move around the country,” Skip Aylesworth, who helps manage about $6 billion for Novato, California-based Hennessy Funds, including shares in both companies, said in an interview last month.

Williams’ crown jewel is Transco, the largest U.S. gas pipeline system. It connects the Marcellus to populous U.S. markets. Williams has contracts underwriting at least $2.5 billion to enlarge Transco, according to the company’s May investor presentation. Its lines connect some Energy Transfer businesses.

“Williams adds scale, complimentary assets that enhance services to producers, synergies and significant potential commercial growth opportunities,” Elvira Scotto, an analyst for RBC Capital Markets, wrote in a June 22 note to clients.

The transaction ranks among the largest in the North American pipeline industry, which last year saw Kinder Morgan Inc. consolidate its partnership assets into one company through transactions with an enterprise value of more than $40 billion, according to data compiled by Bloomberg. Kinder Morgan’s market value is now about $67 billion.

Energy Transfer Equity and Williams are poised to become one of the top-six largest U.S. energy companies. The two companies had a combined market value as of September 18 of more than $60 billion. Williams will pay a $428 million termination fee to the partnership, according to a separate statement.

Energy Transfer announced June 21 it had offered $48 million in stock for Williams. After rejecting the offer, Williams began taking bids in a process handled by Barclays Plc and Lazard Ltd. Energy Transfer agreed to participate in the auction in July.

Energy Transfer’s initial offer depended on Williams abandoning a consolidation of its partnership the company had announced in May. Williams had proposed buying the rest of Williams Partners LP units it doesn’t already own for $14 billion.

Williams had said that deal would simplify its structure, reduce taxes and generate cash for expansion projects. Energy Transfer argued its bid would provide better value to Williams investors.

Energy Transfer controls three other partnerships: pipeline owner Energy Transfer Partners LP, fuel distributor and retailer Sunoco LP, and Sunoco Logistics Partners LP, an owner of pipelines carrying crude oil and refined products.