Gray Television of Atlanta has bought Montgomery-based Raycom Media for $3.65 billion, according to a statement released this morning.

The deal is expected to close in the fourth quarter of the year and create the third largest television group in the country.

Under the deal's terms, Gray will acquire Raycom Sports, which owns the ACC Network, production company Tupelo Raycom, automotive programming and production company RTM Productions, and Broadview Media, a post production and digital sign company. The combined company will have 142 television stations in 92 markets.

Raycom will sell Community Newspaper Holdings, Inc., a newspaper company in 23 states, and a PureCars, a digital ad platform.

Raycom owns stations in four Alabama markets - Birmingham, Montgomery, Dothan and Huntsville.

Current Raycom Media president and CEO, Pat LaPlatney, will become Gray's president and co-CEO and will join Gray's board of directors. Hilton Howell, Gray's current president and CEO, will become executive chairman and co-CEO.

The combined net revenue of the two companies is expected to be $2 billion.