Bank of America Corp. agreed to pay MBIA Inc. $1.7 billion to settle a dispute over soured mortgage securities, in the second-largest U.S. bank's latest bid to reduce legal risks tied to its home-lending business.

The pact is the fifth settlement the Charlotte, N.C., company has reached this year, totaling $16.9 billion in cash and other relief. News of the agreement sent shares of MBIA, an Armonk, N.Y., bond insurer, up 45%. Bank of...