The agreement cements Microsoft's exclusive relationship with Facebook to serve ads on its site and keeps out competitors, including Google.
Facebook has been working with Microsoft for a year and has decided to expand its partnership to a global relationship.
The software group already has a deal with Facebook in the US which lasts until 2011 and gives it exclusive rights to provide banner ads. The new deal will make Microsoft the site's exclusive third-party advertising platform partner and it will begin to sell advertising for Facebook internationally, as well as in the US.
It is not clear whether the deal will include search advertising as well as display advertising. If not it leaves the way open for Google and other competitors to seal a separate deal to sell search advertising.
Facebook is growing faster than the top social networking site MySpace and Kevin Johnson, president of Microsoft's platform and services division, said that the growth opportunities justify Microsoft's investment in the site.
Facebook has almost 50m users and its membership grew more than 6% in September, compared with MySpace growth of 1% to 107m users, according to research company ComScore.
With an average of 200,000 new users registering every day, Facebook continues to be one of the most trafficked sites on the internet.
Owen Van Natta, chief revenue officer at Facebook, said: "We think this expanded relationship will allow Facebook to continue to innovate and grow as a technology leader and major player in social computing, as well as bring relevant advertising to nearly 50m active users of Facebook."
Johnson said: "The opportunity to further collaborate as advertising partners is a big reason we have decided to take an equity stake, and is a strong statement of our confidence in the long-term economics of this partnership."