Bank of America Corp agreed to sell preferred and common shares of Brazil's Itau Unibanco in a deal valued at 8.16 billion reais ($4.5 billion), ending a partnership started in 2006 when the Brazilian bank took over the local unit of FleetBoston Financial.

Itau Unibanco said in a securities filing on Tuesday that Bank of America agreed to sell all of its 188.42 million preferred shares of the Brazilian bank in a secondary offering.

The sale of American Depositary Shares, each representing one preferred stock, will target pension funds and other so-called qualified investors in the United States and outside of Brazil, Itau Unibanco said.

The preferred shares lost 0.7 percent before the announcement in Sao Paulo to close at 27.78 reais.

Itau Unibanco expects the secondary share offering to take place during the week of May 31.

The Charlotte, North Carolina-based bank also agreed to sell 56.48 million common shares of Itau Unibanco to Itau's parent, Itausa , the Brazilian bank said. The thinly traded common shares lost 3 percent to close at 11.22 reais on Tuesday.

Itausa's board approved the sale of 1.4 billion reais of bonds in Brazil's domestic market to fund the purchase of the common shares, Itau Unibanco said.

Bank of America will no longer have the right to appoint a person to Itau Unibanco's board or have tag-along rights during an eventual sale of control of the Brazilian bank after the stake sales are finalized, Itau Unibanco added.

Itau Unibanco bought FleetBoston's BankBoston's businesses in Brazil, Uruguay and Chile from Bank of America in 2006 in a stock transaction valued at about $2.8 billion at the time that gave the U.S. bank the minority stake.

(Reporting by Elzio Barreto; editing by Andre Grenon)