HBOS and Lloyds TSB are now to form a new "super-lender", which will cover almost a third of the entire UK mortgage market.
The shares-only deal values HBOS at just $22 billion - a fraction of its pre-credit crunch market price.
However, stock in the lender has been hammered on the markets over recent days, due to investors' concerns over the firm's liquidity.
The British government, led by prime minister Gordon Brown, is thought to have been instrumental in the takeover talks.
An HBOS failure would have dwarfed last year's collapse of mortgage lender Northern Rock, both in its financial and political cost.
"This will be a unique opportunity to accelerate and extend our strategy and create the UK's leading financial services group," said Lloyds chairman Sir Victor Blank.
HBOS chairman Dennis Stevenson added: "This is the right transaction for HBOS and its shareholders."