Wells Fargo & Co. agreed to a $3.7 billion settlement with the Consumer Financial Protection Bureau to settle a variety of allegations of mistreating customers, including a $1.7 billion fine that’s the biggest in CFPB history.

The agreement includes more than $2 billion in “redress to consumers,” the CFPB said in a statement Tuesday that cited “widespread mismanagement” of auto loans, mortgages and deposit accounts.