Facebook and Microsoft announced Monday that they have struck a deal for over 1,000 patents, including some of the patents Microsoft recently acquired from AOL.

According to the release, Facebook will pay around $550 million in cash for the patents. Microsoft and AOL announced their patent deal on April 9, with Microsoft grabbing up over 800 of AOL’s patents for $1.1 billion.

The social network will own approximately 650 patents from AOL, plus a license to the patents that Microsoft owns. In turn, Microsoft will keep ownership of approximately 275 of its patents and will have a license to the AOL patents now owned by Facebook.

“Today’s agreement with Facebook enables us to recoup over half of our costs while achieving our goals from the AOL auction,” said Microsoft’s Brad Smith, executive vice president and general counsel, in a statement. Microsoft owns an estimated 1.6 percent of Facebook shares. The two companies have worked closely together in the past on efforts such as Skype integration into the social network. It had, however, been reported by Bloomberg that Microsoft outbid Facebook for the AOL patents.

The patents are undoubtedly meant to be a defensive stockpile for Facebook. The social network recently filed a countersuit against Yahoo, which has accused Facebook of infringing on several patents regarding social networking, ad placement and user customization. Facebook, in turn, denied the accusations of infringement and claimed that Yahoo violates Facebook patents including those related to photo-sharing, the real-time news feed and tagging digital media.

Ted Ullyot, Facebook’s general counsel said, “This is another significant step in our ongoing process of building an intellectual property portfolio to protect Facebook’s interests over the long term.”

Facebook is likely angling to resolve the Yahoo case as quickly as possible, given the company’s impending market debut. The company, which filed its paperwork to go public earlier this year, is expected to begin trading on the NASDAQ in mid to late May.

Related stories:

Facebook said to have date for IPO

AOL sells patents to Microsoft in $1.1 billion deal

Facebook files Yahoo countersuit