The agreement was announced shortly after midnight Friday following marathon negotiations between the bank and federal officials.
It marked the latest effort by the Bush administration to bolster the banking system in the face of the worst financial crisis since the Great Depression.
The $20 billion injection of fresh capital will come from the government's $700 billion rescue fund and will be similar to assistance provided in November to another troubled bank, Citigroup.
Bank of America will use the money from the rescue fund to help it absorb losses at Merrill Lynch.
The loan guarantees will cover about $118 billion in loans and other holdings such as securities backed by residential and commercial real estate loans. The bulk of these holdings were obtained by Bank of America in its acquisition of Merrill Lynch, a deal which closed earlier this year.
The Treasury Department already has pledged the first half of the $700 billion bailout fund, which Congress approved on Oct. 3, to deal with the nation's financial crisis.
However, President Bush, on behalf of President-elect Barack Obama, asked Congress to release the second half of the bailout fund earlier this week and on Thursday the Senate voted 52-42 to turn aside an attempt by opponents to block the release of the remaining $350 billion from the bailout fund.
Before the new support package, Bank of America had received a total of $25 billion in capital injections from the Treasury bailout fund, called the Troubled Asset Relief Program, or TARP, including $10 billion for Merrill Lynch.
In a statement, Treasury said the new support was designed "to strengthen the financial system and protect U.S. taxpayers and the U.S. economy."
"It gets down to the cost of the acquisition of Merrill and the risks associated with the deal," said Gary Townsend, president of Maryland-based private investment group Hill-Townsend Capital. "They were obviously in contact and in discussion with the Treasury prior to the end of year close."
Even with the government aid, Bank of America's stock has been pummeled.
Shares of the Charlotte, N.C.-based bank are down more than 27 percent this year - dropping to their lowest level in 18 years - and lost $1.80, or 17.5 percent, to $8.40 in late afternoon trading Thursday after trading as low as $7.35 earlier in the session. Rival Citigroup's shares plunged 87 cents, or 19.5 percent, to $3.66 after falling as low as $3.36 earlier in the session.
Bank of America declined comment on the new aid package on Thursday. Some analysts are predicting the nation's biggest bank by assets will report a loss or lower-than-expected earnings for the fourth quarter. Its board has already halved the company's dividend and could slash the payout again. It had been expected to report its fourth quarter results next Tuesday, but the bank moved up the release to early Friday.
"We don't know how they are going to be," said Bert Ely, a banking industry consultant in Alexandria, Va. "The question is can they handle the recognition of the committed losses, however bad they are going to be, if they are there."
Analysts polled by Thomson Reuters, on average, expect Bank of America to earn 8 cents per share during the quarter and $1.15 per share for 2008.
Fears about the stability of the financial industry had gripped Wall Street in recent days, sending stocks plunging. Wall Street investors are worried about another round of losses from banks, which had been especially hard hit by the worst financial crisis since the 1930s.
Against that backdrop, the federal government has taken radical steps - including making capital injections in banks - to shore up the nation's shaky financial system and to try to get credit flowing more freely again.
Problems, however, have persisted. Federal Reserve Chairman Ben Bernanke earlier this week made a forceful case that the second $350 billion bailout installment was critically needed.
In the Citigroup rescue late last year, the bank received a fresh $20 billion capital infusion from Treasury's bailout fund - after earlier receiving $25 billion - as well as government backing of billions of dollars in risky assets held by the bank.
Specifically, Treasury and the Federal Deposit Insurance Corp. provided a guarantee against the possibility of losses on up to $306 billion of risky loans and securities backed by New York-based Citigroup's commercial and residential mortgages. Funds from the FDIC and $5 billion from the bailout money would be used for the guarantees.