Burger King Holdings Inc , the No. 2 U.S. fast-food chain, agreed to be bought by investment firm 3G Capital for $24 per share, or about $3.26 billion.

The deal represents a 46 percent premium to Burger King's share price before news of the deal talks emerged on Wednesday, the companies said.

Including the debt that 3G will assume, the deal is worth about $4 billion, the company said on Thursday. The transaction is expected to close in the last three months of 2010.

TPG Capital LP, Goldman Sachs Capital Partners and Bain Capital Investors collectively own about 31 percent of Burger King's shares and will tender their shares into the offer, which is due to begin by September 17.

Burger King has lagged larger rival McDonald's Corp and other fast food chains as its key customer base takes a deeper hit from persistently high unemployment rates.

Last week, the company forecast weak demand during its new fiscal year due to the U.S. economy's slow pace of recovery and government austerity programs in several European countries.

Analysts said it was an opportune time for the company to go private, just over four years after the group of private equity firms took it public in May 2006 at an initial share price of $17.

Shares of Burger King were up more than 23 percent to $23.25 in early trading and had gained nearly 15 percent on Wednesday.

(Reporting by Michele Gershberg and Phil Wahba, editing by Gerald E. McCormick, Dave Zimmerman)