Energy regulator Ofgem said it believes the firms – British Gas, EDF Energy, Npower, SSE, Scottish Power and E.ON – have kept credit owed to 3.5 million domestic and 300,000 business customers over the past six years.
Ofgem said the amount of money being retained by brands is "unacceptably large" and will erode consumers’ confidence that they are able to switch supplier without losing money.
Andrew Wright, interim chief executive at Ofgem, said: "When many people are struggling to make ends meet, it is vital that energy companies do the right thing and do all they can to return this money and restore consumer trust.
"We want to see decisive action by suppliers, individually and collectively, to address this issue and, wherever possible, to ensure that the balances they currently hold are returned to consumers.
"Where this can’t be done any remaining sums should be used to benefit consumers more generally, and suppliers need to be very clear with consumers about what they will be doing with this money," added Wright.
Earlier this week, Ofgem announced rules to provide greater billing transparency to consumers and "tear down the barriers to competition" in the UK's gas and electricity market.
The changes follow a number of mis-selling scandals hitting suppliers. Last year SSE was fined £10.5m by Ofgem for breaching marketing obligations that led to customers being "missold" energy deals.