T-Mobile and Sprint announced Sunday that they will merge the two wireless companies, bringing the number of major cellphone companies to three. The combined company will be named T-Mobile.

In a joint statement, the wireless carries said the combined company will have lower costs and better quality, that could essentially help them compete with AT&T and Verizon.

The proposed all-stock deal values Sprint at about $59 billion and the combined company at $146 billion.

Get Breaking News Delivered to Your Inbox

Sprint dropped its bid for T-Mobile more than three years ago after running into concerns about wireless competition in the Obama administration. The two were poised to combine in October, but that deal was called off, too.

Sprint and its owner, the Japanese conglomerate SoftBank, have long been looking for a deal as the company has struggled to compete on its own.

Sprint has a lot of debt and has posted a string of annual losses. The company has cut costs and made itself more attractive to customers, BTIG Research analyst Walter Piecyk says, but it hasn't invested enough in its network and doesn't have enough airwave rights for quality service in rural areas.

T-Mobile, meanwhile, has been on a yearslong streak of adding customers. After the government nixed AT&T's attempt to buy the company in 2011, T-Mobile led the way in many consumer-friendly changes, such as ditching two-year contracts and bringing back unlimited data plans. Consumers are paying less for cellphone service, thanks to T-Mobile's influence on the industry and the resultant price wars.

"T-Mobile does not need a merger with Sprint to succeed, but Sprint might need one to survive," Piecyk wrote in a research note.

But MoffettNathanson analyst Craig Moffett said T-Mobile's momentum is slowing, which may explain why the company and its parent, Germany's Deutsche Telekom, "have warmed to the idea of a merger sooner rather than later."

The supersized company would have nearly as many wireless subscribers as Verizon and AT&T have now. T-Mobile and Sprint could save money by merging their networks and closing stores.

The Communications Workers of America, a union for telecommunication workers, says the merger will cost at least 20,000 U.S. jobs and reduce competition in wireless, bringing higher prices.

But the cost savings could help the combined company build infrastructure and buy rights to the airwaves needed for faster "5G" service that is expected to be up in running within the next few years.