(Adds comments from source on terms and reasoning)
NEW YORK, June 4 (Reuters) - Sprint Corp has agreed to pay about $40 per share to buy T-Mobile US Inc, a person familiar with the matter told Reuters on Wednesday, signaling progress in a long-contemplated deal to merge the third- and fourth-largest U.S. wireless carriers.
At that price, about a 17 percent premium to the carrier's Wednesday close, T-Mobile would be worth more than $32 billion. But the person said many other details needed to be worked out that would affect how much money changed hands.
Deutsche Telekom owns 67 percent of T-Mobile and is expected to keep a 15 to 20 percent stake of the combined company as part of the deal, the source said on condition of anonymity because the discussions were private.
Other details such as financing and due diligence also need to be worked out, the source added.
Still, the broad agreement between Sprint, owned by Japan's Softbank Corp, T-Mobile and other parties on issues such as price show that both sides are making progress.
U.S. regulators have been vocal about their opposition to the deal, one of several mega-mergers awaiting clearance, and it remains unclear how either side intends to overcome that obstacle.
The telecoms and media sector is in the throes of a major consolidation, with AT&T Inc eyeing DirecTV and Comcast trying to merge with Time Warner.
That may create a clutch of media and wireless giants and leave Sprint an also-ran with an inferior business, the source told Reuters.
Softbank Chairman Masayoshi Son had long been eager to buy T-Mobile and merge it with Sprint, creating a carrier with the resources to upgrade its network and better compete with market leaders AT&T and Verizon Wireless.
For Deutsche Telekom, an exit from the United States would allow it to beef up its operations across Eastern Europe.
But the U.S. Federal Communications Commission and Justice Department have raised concerns about such a tie-up, revolving around the risk that it could raise prices for consumers. U.S. regulators rejected AT&T's $39 billion takeover bid for T-Mobile US in 2011.
"The agencies have tipped their hand and the parties know that," said an antitrust expert who spoke anonymously to protect business relationships.
They "must think that they have stronger arguments and they're willing to battle them out with the agencies. That has to be part of their calculus here."
Sprint declined to comment on the story, which was first reported by Bloomberg. T-Mobile did not respond to requests for comment. Softbank and Deutsche Telekom were not available for comment.
(Reporting by Diane Bartz in Washington, Marina Lopes in New York, and the San Francisco newsroom; Editing by Steve Orlofsky and Ken Wills)