The error - caused by mixing up measurements from older imperial meters with modern metric ones - is thought to have affected thousands of people.
The regulator has ordered gas suppliers to refund any affected customers.
The problem came to light after energy firm E.On discovered that it had overcharged 350 of its customers.
One customer paid too much for 15 years, E.On has admitted.
The company said that all compensation would be worked out on an individual basis.
Those that have been overcharged are people who have imperial meters - which measure gas use in hundreds of cubic feet.
They have been charged as if they had used cubic meters instead.
Some people in the reverse situation have been undercharged, but they will not have to pay any extra.
E.On has identified 250 customers in that position. They should have paid 65% more than they did.
The regulator, Ofgem, believes that several thousand households may have been affected in total.
As a result, all the other energy firms have been ordered to identify any customers who have been overcharged by Friday this week.
"We have written to suppliers and asked them to refund affected customers," an Ofgem spokesperson told the BBC.
Ofgem said the mistake had been caused by human error.
E.On said the 350 customers who had paid too much would be refunded in full, "plus interest and appropriate compensation".
Customers themselves do not need to take any action.
However details on the difference between cubic and metric meters can be found here.
Trade body Energy UK said firms were "working hard" to address the issue.
The trade association, which represents the major energy companies, said "detailed analysis" showed "an extremely small number of accounts" had been affected.
"Any customer affected will be contacted shortly by their supplier and where there has been overcharging, a refund will be issued as quickly as possible," it added.
Some householders have been paying nearly three times too much for their gas, after at least one energy supplier got its maths wrong.