Finance company Ares Capital Corp said it will buy rival Allied Capital Corp in an all-stock deal valued at $648 million.

The $3.47 per-share offer represents a 27 percent premium to Allied's Friday close. Under the deal, Allied Capital shareholders will get 0.325 Ares Capital shares for each share held.

Shares of Allied Capital rose 20 percent, while Ares was up 4 percent.

The deal comes at a time when Allied Capital has been shedding assets to pay down debt and fight liquidity concerns.

Following the transaction, Ares Capital stockholders will own about 65 percent of the combined company.

The transaction is expected to close by the end of the first quarter of 2010, Ares said.

Separately, Ares Capital will also buy Allied Capital's interests in Senior Secured Loan Fund LLC, formerly known as Unitranche Fund, for $165 million in cash. (Reporting by Archana Shankar in Bangalore; Editing by Vinu Pilakkott)