Yahoo is near a deal to sell its core online assets, ending a 20-year run as an independent company for one of the most storied names on the internet.

Media reports said Yahoo, which introduced many users around the world to the internet, was close to selling its main assets for $5 billion.

The online news site Re/Code reported that telecom giant Verizon had emerged as the buyer unless another bidder boosted the price.

The report said a deal could be announced by Monday, with Verizon poised to integrate Yahoo with another online acquisition, AOL.

The news underscores the sharp decline for Yahoo, which in 2008 spurned a $44 billion bid from Microsoft and has been struggling in recent years to counter the rise of online giants Google and Facebook.

Yahoo has been in restructuring mode for nearly four years under chief executive Marissa Mayer, who came from Google in an effort to help the internet pioneer regain its past glory.

The deal would allow Yahoo to separate its main assets from its holdings in Chinese internet giant Alibaba, which accounts for most of Yahoo's $37 billion market value.

The exact terms of any acquisition were not clear. Yahoo declined to comment on the process "until we have a definitive agreement," a company statement said.

But any deal would almost certainly include the popular Yahoo News, Mail and other online services used by more than a billion people worldwide.

Yahoo remains a major force online, but has lagged its rivals in its ability to "monetize" its audience through advertising that is linked to customers' browsing and other online activities.

Several other bidders have been in talks, according to reports, including Quicken Loans founder Dan Gilbert, who is being backed by billionaire Warren Buffett.

But Verizon appeared to be the leading candidate, because of its ability to integrate AOL's advertising technology into Yahoo services.

"We continue to believe Verizon is the most sensible buyer, to combine with AOL, cut costs and leverage proprietary first-party data," said Daniel Salmon at BMO Capital Markets in a research note.

Yahoo earlier this month reported a $440 million quarterly loss, in part because of writedowns on the value of some assets.

Mayer declined to comment on any bids at the time but said the company would pursue its reorganization at the same time it negotiates with bidders.

But Yahoo has been under pressure from shareholders to break up the company to "unlock" the value of its holdings in Alibaba and Yahoo Japan, and to find a new path for the company after years of sputtering.