AT&T Inc. struck a deal to carry Dish Network Corp.’s existing cellphone customers over its wireless network, bringing two erstwhile rivals closer as they each pursue more advanced 5G technology.

The nonexclusive deal, disclosed in a securities filing Monday, would pay AT&T at least $5 billion over 10 years to support Dish’s consumer cellphone brands, which include Boost Mobile, Ting and Republic Wireless. The agreement also provides an avenue for AT&T to use some Dish wireless spectrum licenses to support both companies’ customers, according to the filing.

The partnership will likely attract scrutiny from the U.S. Justice Department, which helped Dish’s entry into the wireless market through a complex deal that cleared the way for cellphone carrier T-Mobile US Inc. to buy Sprint Corp. The government allowed the asset swaps to proceed under the assurance that Dish would build a new fifth-generation network over several years.

Dish’s nearly 9 million wireless customers currently use T-Mobile’s network. The two companies have tussled over various issues, including T-Mobile’s plan to shut down its 3G network by Jan. 1, 2022. Dish has said the early sunset could cut off many of its customers who need more time to upgrade their cellphones to 4G and 5G smartphones. AT&T has said it would wind down its 3G service in early 2022.

Analysts at Cowen estimated T-Mobile gets $1.5 billion to $2 billion a year serving Dish’s customer base. “We can presume that Dish is getting a better deal with AT&T…or one with similar pricing but longer time frame and without a contentious partner,” the investment bank wrote Monday in a note to clients.

Monday’s announcement made no mention of AT&T’s DirecTV satellite unit, which competes with Dish. Wall Street analysts have predicted that the two TV providers could save money by merging, though antitrust enforcers might resist the combination of two businesses that are often the only source of pay-TV channels in rural areas. Dish Chairman Charlie Ergen has said he considers the tie-up inevitable.

Dallas-based AT&T is focusing its attention on its core telecommunications services after a string of mixed results from entertainment. The company in February agreed to spin off a 30% stake in DirecTV to private-equity firm TPG. The carrier later struck a deal with Discovery Inc. to spin off its WarnerMedia segment into a new publicly traded company.

AT&T last week reported that DirecTV continued shedding subscribers in the second quarter, though the decline had slowed compared with losses seen over the past year. The company is scheduled to report full quarterly results Thursday.

Write to Drew FitzGerald at andrew.fitzgerald@wsj.com