Facebook and Yahoo! are in talks about forging an alliance that could spell the end of Yahoo!’s relationship with Microsoft.

Sources have told The Sunday Telegraph that Marissa Mayer, chief executive of Yahoo!, has held discussions with Sheryl Sandberg, Facebook’s chief operating officer, about how the two companies can work more closely together.

The two internet giants have already collaborated together on a number of small projects, for example to share Yahoo! news on Facebook, and recently agreed to settle a number of long-standing lawsuits over patents. However, board members expect the talks to lead to much more substantial collaboration based around web-based search.

Facebook has already said it plans to boost its web search facility, with founder Mark Zuckerberg noting that the social network is “pretty uniquely positioned to answer the questions people have”.

Forging an alliance with Yahoo! would allow the social network to take a major leap forward in search, ensuring it remains central to its users’ lives and helping to target advertising more efficiently.

Meanwhile, Yahoo!, which started life as one the first major search engines but is now dwarfed by rival Google, would benefit from Facebook’s vast army of more than 1bn users.

The computer codes which power search engines become more powerful as more people use them, making it tough for Yahoo! to stage a comeback without help from another, more popular organisation.

Working with Facebook would also allow Yahoo! to piggyback on the social network’s brand cachet to help it recruit top-tier computer programmers – something that has been a major problem for Yahoo! in the past two years as it has hired and fired a string of chief executives. An alliance between Facebook and Yahoo! will pose a major threat to Google and stands to reorder the hierarchy of the world’s biggest technology companies. A senior figure likened Yahoo!’s position to that of a minority party in a hung parliament, with the power to act as kingmaker by choosing another party with which to align itself.

Silicon Valley observers had speculated that Ms Mayer could throw Yahoo!’s lot in with Google, her former employer, but instead she and Ms Sandberg, who is also a former Google executive, are expected to use their combined might to launch a serious competitor.

However, Google is not the only major technology business under threat from the Facebook-Yahoo! alliance. It also throws Yahoo!’s relationship with Microsoft into doubt.

The two companies signed a deal in 2009 for Microsoft’s own Bing search engine to power all of Yahoo!’s search results, leaving Yahoo! to focus on selling search advertising. Yahoo! insiders claim the alliance has been problematic, because Microsoft has not been able to attract the right “maths geeks” to mount a serious challenge to the likes of Google.

Yahoo! is thought to be looking at ways to extricate itself from the 10-year deal but its own talent pool of expert programmers has depleted so much that it is not in a position to strike out on its own.

Google dominates the market with around a 66pc share. Bing has had some effect at the edges, with just under 16pc of all searches taking place on the platform.