EE and Virgin Media have been fined £13.3m by Ofcom for leaving customers who quit broadband and phone contracts early "out of pocket".
The regulator said about 400,000 EE customers who ended their contracts early were over-billed and paid up to £4.3m too much as a result.
Ofcom said about 82,000 Virgin customers were overcharged by almost £2.8m. Virgin said it would appeal.
Margot James, Digital Minister, said companies need "to play by the rules".
Gaucho Rasmussen, director of investigations and enforcement at Ofcom, said: "EE and Virgin Media broke our rules by overcharging people who ended their contracts early. Those people were left out pocket and the charges amounted to millions of pounds."
Fine 'not justified'
The fine for Virgin Media was £7m, Ofcom said, with an additional £25,000 for providing incomplete information to the regulator.
Ofcom found that Virgin Media had levied early-exit charges that were higher than customers had agreed to when signing up to their residential contracts. The regulator said this went on for almost a year.
However, Virgin Media said it "strongly disagrees" with Ofcom's decision and would appeal to the Competition Appeal Tribunal.
"This decision and fine is not justified, proportionate or reasonable. A small percentage of customers were charged an incorrect amount when they ended one or more of their services early and for that we are very sorry," said Tom Mockridge, chief executive of Virgin Media.
Virgin Media said it had mistakenly overcharged 1.5% of its 5.5 million cable customers between September 2016 and August 2017.
The company has reimbursed or made charity donations covering 99.8% of its overcharging.
Virgin's unfair fees had a "devastating" impact on my credit rating
John Jones, from Hatfield in Hertfordshire, a Virgin Media customer for seven years, arranged to terminate his account when he moved house and the firm said it did not service his new address.
Virgin told him he would have to pay a "breaking contract charge" of £240.
"That was in spite of the fact that I had been a customer of theirs for seven years, wanted to continue using their services, but could not do only because they did not service my new address," he says.
His attempts to get Virgin to remove the charge were unsuccessful and he agreed to pay as he did not want his credit rating to be affected.
The charge was due to be taken in January last year by direct debit, but Virgin did not take it until the 16 February. But on 9 February, Virgin Media made a so called "derogatory report" to credit reference agencies saying John had let his account fall into arrears.
John says this had "a devastating effect" on his credit rating.
His rating with Equifax fell from excellent to fair, whilst his rating with Experian dropped from excellent to poor.
"It took me 10 phone calls and emails over a period of 29 days to get Virgin Media's credit control section to agree to correct their error with the Credit Reference Agencies.
"Although they have recovered since, my credit ratings have yet to get back to the levels they were before this event happened," he says.
Customers yet to be repaid
EE apologised to customers after it was fined £6.3m following Ofcom's discovery that over a six-year period the firm did not set out the charges its mobile customers would have to pay if they left their contracts early.
Ofcom said that up to 15 million EE customers faced being over-billed by up to £13.5m as the company had miscalculated early-exit charges. However, not all affected customers had paid these excessive charges as EE had subsequently waived some of them, leaving £4.3m in excessive charges.
A spokesperson for EE said: "We've already refunded customers and changed the way we calculate early termination charges, and we will continue to focus on ensuring our policies are clear and fair for all customers."
However, Ofcom said that £1.6m of the £4.3m of the overcharged fees had not been repaid as EE did not have records covering the whole period. Customers who feel they may have been overcharged should contact EE.
'Play by the rules'
Digital Minister Margot James said: "We've strengthened Ofcom's powers to better protect consumers and these fines show the issue is being taken very seriously and strong action will be taken.
"Companies need to play by the rules and treat their customers fairly and honestly," the minister said.
Gillian Guy, chief executive of Citizens Advice, said: "Anyone who has been affected by this deserves a refund.
"This is another in a long line of failings in the mobile and broadband industry - we need an independent consumer champion to stick up for customers and stop this from happening."
Ofcom said the behaviour of both companies made customers less likely to switch provider, which was against its rules.