Shares of technology companies rose and the Nasdaq Composite hit a new record high as deal intrigue buoyed Microsoft and Apple's shares.

Microsoft is reportedly pursuing an acquisition of the U.S. operations of TikTok, as the Chinese social media company faces security concerns.

President Trump confirmed he is open to a deal in which the Seattle software giant or another U.S. company bought the video-sharing app, but said the government should receive payment for clearing a purchase.

Apple shares rose after Bloomberg News reported it agreed to buy Canadian company Mobeewave, which has technology to transform iPhones into payment terminals, a business that has already proved lucrative for startup Square.

An artificial-intelligence company that has patented a voice-activated assistant comparable to Siri, Shanghai Zhizhen Net, has filed a patent infringement lawsuit against Apple that, if successful, could prevent the American tech giant from selling many of its products in the world's second-largest economy.

Some strategists warn the extraordinary rally for companies like Apple, Microsoft, Zoom Video Communications and Amazon.com, all seen as beneficiaries of stay-at-home trends, cannot last much longer. Strategists at brokerage Morgan Stanley view "the current skew between the Covid beneficiaries and laggards as an unhealthy sign, and therefore unsustainable."

Shares of electric-vehicle makers rallied after Tesla rival Nio reported a more-than four-fold increase in July vehicle deliveries.

Write to Rob Curran at rob.curran@dowjones.com