Internet pioneers Yahoo Inc. and AOL were closing in on a deal late Wednesday that would combine their businesses into an online advertising giant, according to four people familiar with the talks.

If consummated, the deal could let Yahoo wriggle out of a situation that this week had seemed inevitable: succumbing to Microsoft Corp.'s unsolicited $42-billion takeover bid.

At the least, Yahoo might be able to extract a higher price from Microsoft, which had refused to sweeten its offer.

The software giant now is talking with media baron Rupert Murdoch's News Corp. about a joint bid that could raise the offer -- increasing the stakes in a fast-changing world of Internet behemoths.

The battle to dominate the online landscape has important ramifications for Internet users.

Combining AOL and Yahoo would create a consumer Internet giant with hundreds of millions of monthly visitors and a dominant position in online news, instant messaging, e-mail and other ad-supported services. It also would deal an enormous blow to Microsoft's Web ambitions.

But all three companies are far behind Google in the most profitable form of online advertising: search.

The talks between Yahoo and AOL parent Time Warner Inc. are continuing. The two are discussing the idea of having Time Warner merge AOL's online advertising business into Yahoo in exchange for a roughly 18% stake. Time Warner would keep AOL's slowing dial-up Internet access unit.

An AOL alliance is a key part of Yahoo's plan to show that it can again grow as an independent company and offer shareholders a viable alternative to Microsoft.

Other elements of a deal include Yahoo's buying back billions of dollars' worth of its shares, which typically helps lift their price, and outsourcing some Web search advertising to Google Inc., which could earn it more money.

Yahoo, based in Sunnyvale, Calif., tested the waters on a Google deal Wednesday, saying it would experiment with putting ads brokered by the Mountain View, Calif., company in some search results.

"Yahoo has shown that it can't do it on its own," said a person close to Yahoo's top management, who requested anonymity because the talks are confidential. "They are trying to see if this really does work for the business. If not, it's a great negotiating ploy."

Microsoft could still strike back. The talks with News Corp., which were characterized as merely exploratory, have focused on merging Yahoo with Microsoft's MSN Web business and News Corp.'s social networking site, MySpace, said two sources familiar with the talks.

None of the companies would comment on the reported merger talks.

In the market test, Yahoo said it planned to have Google place ads on about 3% of its searches in the U.S. for no more than two weeks. Microsoft responded swiftly, contending that an alliance between the top two search players would hurt competition.

Analysts said the latest salvo in the two-month battle for control of Yahoo significantly complicated Microsoft's bid.

Yahoo combined with Google on search and with AOL on other Web ads "might be palatable to investors," said one major shareholder, who spoke on condition of anonymity because his company doesn't discuss individual holdings.

He said the companies' tactics were straining investors' patience and that he would prefer a sweetened Microsoft offer, but he "wouldn't mind owning" shares of a revamped Yahoo.

Yahoo has rejected Microsoft's offer as too low. Its top executives wrote in a letter to Microsoft Chief Executive Steve Ballmer on Monday that they were open to merging for the right price. Meanwhile, they continued to negotiate with AOL.