Verizon Communications Inc. (NYSE: VZ) agreed to sell its data-centers business to Equinix Inc. (Nasdaq: EQIX) for $3.6 billion in cash as the company turns its focus to mobile video advertising.

The deal includes 24 facilities across 15 metropolitan markets, according to a statement. Equinix, based in Redwood City, California, operates as a real estate investment trust, mostly holding interconnected data centers. With the deal, Equinix now has 175 data centers in 43 markets around the world.

Data center deals have been picking up in the middle market. Equinix Inc. (Nasdaq: EQIX) is adding Bit-isle Inc.; Fusion Telecommunications International Inc. (Nasdaq: FSNN) has agreed to buy call center software company Technology for Business Corp.; and TierPoint LLC has agreed to buy Cosentry.

For Verizon, the deal marks an exit from the data-hosting and cloud-services business five years after the the carrier bought Terremark Worldwide Inc. for $1.3 billion. As prospects faded and Verizon invested more areas like mobile video and advertising, the company decided to put the data-centers unit up for sale about two years ago.

As the telecommunications industry matures, Verizon is shedding assets and turning the business in a new direction. Using go90, its video-streaming business, AOL’s web properties and the pending purchase of Yahoo Inc., Verizon is entering a mobile video and advertising arena to challenge Google and Facebook Inc. (Nasdaq: FB).

The sale to Equinix, which is expected to close in the middle of 2017, would help replenish Verizon’s cash after it acquires Yahoo for $4.83 billion and bids for coveted airwaves in a federal auction.

Verizon’s advisers were Citigroup Inc. (NYSE: C)  and Guggenheim Partners, with Jones Day providing legal counsel. Equinix was advised by Evercore Partners Inc. (NYSE: EVR), JPMorgan Chase & Co. (NYSE: JPM) and law firm Davis Polk & Wardwell LLP.

— Additional reporting by Mergers & Acquisitions’ Demitri Diakantonis