British Gas has paid out £2.65m in refunds, compensation and redress, industry regulator Ofgem has announced.
The energy supplier paid out the money after overcharging 94,211 customers who were switching to a new supplier.
Ofgem said Centrica-owned British Gas misinformed customers by issuing incorrect terms and conditions about exit fees.
The company then wrongly charged them to some customers and applied incorrect charges to others, when their fixed deals came to an end.
The mistake occurred due to a system error, which led to customers being overcharged £782,450 in total.
The watchdog also said British Gas wrongly informed 2.5 million customers that exit fees were chargeable during the 49-day period before their fixed deal expires.
They then incorrectly charged exit fees totalling £64,968 to 1,698 fixed deal customers.
Ofgem opened its investigation in July 2017, after concerns were raised by a money-saving website.
Anthony Pygram, the regulator’s director of conduct and enforcement, said: “British Gas failed its customers who were coming to the end of their fixed contracts and switched supplier by unfairly penalising them and applying charges in error.
“Many more customers could have been deterred from getting a better deal due to the incorrect terms and conditions.
“Ofgem put in place the switching window to help all customers switch before they are rolled onto their supplier’s expensive default rate.
“Our enforcement action against British Gas sends a strong message to all suppliers that they must respect their customers’ rights during the switching window and always treat customers fairly.”