AOL (AOL) scored a $1.06 billion transaction on Monday to sell more than 800 coveted patents to Microsoft (MSFT) and give the tech giant non-exclusive license to other patents.

New York-based AOL said it plans to return a significant chunk of the proceeds to shareholders.

Wall Street cheered the news, sending shares of AOL surging as much as 40%.

“The agreement with Microsoft represents the culmination of a robust auction process for our patent portfolio,” AOL CEO Tim Armstrong said in a statement. “The combined sale and licensing arrangement unlocks current dollar value for our shareholders and enables AOL to continue to aggressively execute on our strategy to create long-term shareholder value.”

Microsoft beat out Facebook and Google (GOOG) in the auction, Reuters reported.

“This is a valuable portfolio that we have been following for years and analyzing in detail for several months,” said Brad Smith, Microsoft’s general counsel.

The companies said they expect the deal to close by the end of 2012.

AOL said it will determine the “most efficient and effective” way to return a “significant portion” of the sale proceeds to shareholders.

In the wake of the transaction, analysts at Miller Tabak raised their price target on AOL to $30.

Shares of AOL soared 35.99% to $25.05 ahead of Monday’s open on the announcement. On the other hand, shares of Microsoft retreated 1.02% to $31.20 amid a 1.1% drop on the S&P 500 futures. 

AOL said even after the sale, it will still hold on to a significant patent portfolio, including more than 300 patents and patent applications.

The deal with Microsoft also includes AOL unloading shares of an unspecified subsidiary that the company expects to record a capital loss on.

Goldman Sachs (GS) and Evercore Partners (EVR) served as financial advisers to AOL on the deal.

Follow Matt Egan on Twitter @MattMEgan5