Gray Television said on Monday it would buy privately held rival broadcaster Raycom Media Inc in a cash-and-stock deal valued at $3.65 billion, in a push to move into more local television markets and attract additional advertising.

The deal comes at a time when the U.S. Federal Communications Commission is making it easier for media companies to buy TV stations in the same market, and for local stations to jointly sell advertising time.

In November, the FCC voted to remove certain roadblocks to increased consolidation among media companies, potentially unleashing new deals among TV, radio and newspaper owners as they seek to better compete with online media.

The transaction will consist of $2.85 billion in cash, $650 million in a new series of preferred stock, and 11.5 million shares of Gray common stock, the companies said.

Wells Fargo has underwritten the debt financing portion of the transaction for $2.53 billion, Gray said.

The combined company will have 142 full-power television stations in 92 markets, the third largest portfolio of stations and markets in the United States, Gray said in a statement.

Gray's station portfolio presently reaches about 10.4 percent of total U.S. television households, and the combined company will boost it to 24 percent, according to the companies.

Gray said it will divest television stations in each of the nine overlap markets it has with Raycom to get antitrust approval.

Raycom plans to sell or spin off units Community Newspaper Holdings Inc, which owns community newspapers, and PureCars, a digital ad platform for the automotive industry. Gray said it will not acquire neither unit as part of the deal.

Raycom President and Chief Executive Officer Pat LaPlatney will become Gray's president and co-chief executive officer, and current Gray CEO Hilton Howell will become executive chairman and co-chief executive officer. The deal is expected to close in the fourth quarter of 2018.

Wells Fargo Securities is the financial adviser, and Cooley and Jones Day served as legal counsel for Gray.

Stonebridge Capital is the financial adviser and Robinson Bradshaw and Covington & Burling is legal counsel for Raycom.