Oracle Corp plans to buy Sun Microsystems Inc for more than $7 billion, after the high-end computer server and software maker's talks with IBM fell apart.

In a surprise announcement on Monday, Oracle said it will pay $9.50 a share. Sun had previously turned down IBM's offer to pay up to $9.40 a share, according to sources with knowledge of the matter.

Oracle President Safra Catz said the acquisition, which the companies expect to close this summer, will add at least 15 cents per share to Oracle's earnings in the first full year after closing.

The deal would strengthen Oracle's position against IBM. Oracle has done a good job on acquisitions it has done earlier, said Robert Jakobsen, analyst at Jyske Bank in Copenhagen. It makes sense also historically. Oracle has been more successful commercializing software than Sun.

Sun shares jumped 36 percent to $9.11 in premarket trading, while Oracle shares fell 4.5 percent to $18.34. IBM shares edged 1 percent lower to $100.22.

Talks between Sun and Oracle began late on Thursday, according to a source with knowledge of the matter who spoke on condition of anonymity.

The two companies have been partners with more than two decades. Oracle's Fusion Middleware, its fastest-growing business, is built on Sun's Java software. Sun's Solaris operating system is also a main platform for Oracle's database business.

Sun rose to prominence in the 1990s but never fully recovered from the dotcom bubble burst in the early 2000s, when demand for its servers cratered.

The company has been looking for a buyer for months, according to bankers with knowledge of the matter, with IBM, Oracle, Hewlett-Packard Co, Dell Inc and Cisco Systems Inc having all been cited as possible buyers.

The Oracle deal values Sun at about $7.1 billion, based on about 745 million shares outstanding, according to Sun's latest regulatory filings.

The companies said the transaction is valued at $5.6 billion net of cash and debt.

Catz said Sun would add more than $1.5 billion to Oracle's operating profit in the first year, rising to more than $2 billion in the second year.

The deal would be more profitable on a per share basis in the first year than Oracle had planned for its previous purchases of BEA, PeopleSoft and Siebel combined, Catz said.

Analysts have said the sale of Sun could signal a new wave of mergers and partnerships in the data center market as companies strive to provide more comprehensive services that tie hardware and software offerings together.

It moves Oracle more into the competition with HP and IBM and Microsoft. It makes them a player in the (enterprise data center) space, said Shannon Cross of Cross Research. It gets hardware, which should be interesting to see since Oracle doesn't make things. It's going to give them access to customers who weren't using the Oracle database.

Sun's board had unanimously approved the deal, which is subject to shareholder and regulatory approval.

(Reporting by Tiffany Wu and Franklin Paul in New York, Tarmo Virki in Helsinki and Jim Finkle in Boston; Editing by Derek Caney)