(Updates to add Chinese state media comment)

NEW YORK/WASHINGTON, Aug 2 (Reuters) - President Donald Trump has agreed to give China's ByteDance 45 days to negotiate a sale of popular short-video app TikTok to Microsoft Corp , three people familiar with the matter said on Sunday.

U.S. officials have said TikTok under its Chinese parent poses a national risk because of the personal data it handles. Trump said on Friday he was planning to ban TikTok in the United States after dismissing the idea of a sale to Microsoft.

But following a discussion between Trump and Microsoft CEO Satya Nadella, the Redwood, Washington-based company said in a statement on Sunday that it would continue negotiations to acquire TikTok from ByteDance, and that it aimed to reach a deal by Sept. 15.

Trump changed his mind following pressure from some of his advisers and many in his Republican party, one of the sources said. Banning TikTok would alienate many of its young users ahead of the U.S. presidential election in November, and would likely trigger a wave of legal challenges. Several prominent Republican lawmakers put out statements in the last two days urging Trump to back a sale of TikTok to Microsoft.

"A win-win in the making," Republican Senator Lindsey Graham tweeted in response to Trump's new stance on Sunday.

The negotiations between ByteDance and Microsoft will be overseen by the Committee on Foreign Investment in the United States (CFIUS), a U.S. government panel that has the right to block any agreement, according to the sources, who requested anonymity ahead of a White House announcement. Microsoft cautioned in its statement that there is no certainty a deal will be reached.

"Microsoft fully appreciates the importance of addressing the President's concerns. It is committed to acquiring TikTok subject to a complete security review and providing proper economic benefits to the United States, including the United States Treasury," Microsoft said in a statement.

ByteDance and the White House did not immediately respond to requests for comment on the Microsoft talks. In a statement issued late on Sunday that did not mention TikTok, ByteDance said it faced "complex and unimaginable difficulties" in going global.

As relations between the United States and China deteriorate over trade, Hong Kong's autonomy, cyber security and the spread of the novel coronavirus, TikTok has emerged as a flashpoint in the dispute between the world's two largest economies.

State-backed newspaper China Daily on Monday called ByteDance the victim of a "witch hunt" from the United States, and said Washington had not provided evidence to support its allegation that TikTok posed a threat to U.S. national security.

Microsoft, which also owns professional social media network LinkedIn, would become a major competitor to social media giants such as Facebook and Snap Inc were its bid for TikTok, which boasts 100 millions U.S. users, to succeed.

Under the proposed deal, Microsoft said it would take over TikTok's operations in the United States, Canada, Australia and New Zealand. It said it would ensure that all private data of TikTok's American users is transferred to and remains in the United States.

Microsoft may invite other American investors to acquire minority stakes in TikTok, the company added. About 70% of the outside capital ByteDance has raised has come from the United States.

It is not clear how much Microsoft could pay for TikTok. Reuters reported last week that ByteDance's valuation expectations for the app exceeded $50 billion, although U.S. pressure to divest it could lower that price tag.

A key issue in the negotiations will be separating TikTok's technology from ByteDance's infrastructure and access, to alleviate U.S. concerns about the integrity of personal data. ByteDance owns a Chinese short video app called Douyin that was based on the same code used for TikTok.

One idea under consideration is to give Microsoft and ByteDance a transition period to develop technology for TikTok that will be completely separate from ByteDance, one of the sources said.

APP SCRUTINY

The United States has been increasingly scrutinizing app developers over the personal data they handle, especially if some of it involves U.S. military or intelligence personnel. Ordering the divestment of TikTok would not be the first time the White House has taken action over such concerns.

Earlier this year, Chinese gaming company Beijing Kunlun Tech Co Ltd sold Grindr LLC, a popular gay dating app it bought in 2016, for $620 million after being ordered by CFIUS to divest.

In 2018, CFIUS forced China's Ant Financial to scrap plans to buy MoneyGram International Inc over concerns about the safety of data that could identify U.S. citizens.

ByteDance was valued at as much as $140 billion earlier this year when one of its shareholders, Cheetah Mobile, sold a small stake in a private deal, Reuters has reported. The start-up's investors include Japan's SoftBank Group Corp .

(Reporting by Greg Roumeliotis and Echo Wang in New York and Matt Spetalnick in Washington, D.C.; Additional reporting by David Shepardson, Peter Schroeder and Alexandra Alper in Washington, D.C., Brenda Goh and Engen Tham in Shanghai; Editing by Jacqueline Wong, Dan Grebler and Edwina Gibbs)