In a rushed bid to ride out the storm sweeping American finance, 94-year-old Merrill Lynch & Co. agreed late Sunday to sell itself to Bank of America Corp. for $50 billion.

The deal, worked out in 48 hours of frenetic negotiating, could instantly reshape the U.S. banking landscape, making the nation's prime behemoth even bigger. Late Sunday night, the companies' boards had approved the deal, but lawyers were negotiating over last-minute details.

Driven by Chief Executive Kenneth Lewis, Bank of America has already made dozens of acquisitions large and small, including the purchase of ailing mortgage lender Countrywide Financial Corp. earlier this year. In adding Merrill Lynch, it would control the nation's largest force of stock brokers as well as a well-regarded investment bank.

The combination, if approved by shareholders, would create a bank of vast reach, involved in nearly every nook and cranny of the financial system, from credit cards and auto loans to bond and stock underwriting, merger advice and wealth management.

Through the weekend, federal officials, including Federal Reserve Bank of New York head Timothy Geithner, made it clear that they strongly encouraged a deal to sell Merrill. They worried the firm could be the next to approach the brink of failure after Lehman Brothers Holdings Inc., said people familiar with the matter.