|The Government wants to change the 'broken' energy market|
The legislation is aimed at cutting bills for households on a standard variable tariff, which critics claim penalises loyal customers who stay with one supplier rather than shop around.
A pledge to change the law was included in the Conservative manifesto before June's General Election, but dropped from the subsequent Queen's Speech after some Tory MPs claimed it was state intervention and anti-free market.
But after 192 MPs of all parties wrote to the Prime Minister in September complaining that poorer customers were being preyed on by energy firms, Mrs May revived the plan and backed a price cap.
Suppliers reacted with fury as billions of pounds were wiped off the value of their shares after the Prime Minister's pledge , which came in the speech overshadowed by a P45 prank, her coughing fit and a collapsing set.
The Bill putting a cap on tariffs is being published in draft and scrutinised by the Business, Energy and Industrial Strategy select committee of MPs, in a move the Government says will help build a cross-party consensus.
Under the draft Bill, the regulator Ofgem would bring in a price cap on the poor value tariffs that exploit customer loyalty, which would protect around two-thirds of households, according to the Government.
"I have been clear that our broken energy market has to change," the Prime Minister said.
"It has to offer fairer prices for millions of loyal customers who have been paying hundreds of pounds too much.
"Today's publication of draft legislation is a vital step towards fixing that, and in offering crucial peace of mind for ordinary working families all over the country."
The Competition and Markets Authority found that customers of the so-called "Big Six" energy suppliers on standard variable and default energy tariffs are paying £1.4bn a year more than they need.
Ofgem this week announced it is extending its existing price cap for vulnerable consumers and the Government says five million households will now, for the first time, benefit from protection against rip-off energy bills this winter.
Four million of those are on pre-payment meters.
The regulator will, from February, protect a further one million households who receive the Warm Home Discount.
The Government says it welcomes Ofgem's move, but claims the regulator could go further to protect everyone on default tariffs from the unfair practices affecting two-thirds of households in Britain.
"The energy market is broken," Business and Energy Secretary Greg Clark said.
"It punishes loyalty. The independent competition authority found millions of people who are customers of the Big Six suppliers are overpaying to the tune of £1.4bn a year.
"That is simply wrong. While five million households will see their bills capped from this winter, I want to see every household protected from rip-off bills.
"That is why we have published this draft legislation today - sending a clear message to suppliers they must act to put an end to loyal consumers being treated so unfairly."
Labour says the Government's proposed legislation does not go far enough.
Chi Onwurah, the party's shadow minister for industrial strategy, science and innovation, told Sky News: "The test of an energy price cap will be how many customers benefit by how much this winter.
"The Government dithered for so long, arguing with the energy regulator, before finally being forced to take any action that it seems unlikely consumers will really benefit.
"A Labour government would immediately introduce an emergency price cap while we transition to a fairer system for bill payers."
There has also been a guarded welcome for the draft Bill from consumer organisation Which.
"For millions of consumers worried about their energy bills, a cap might sound like a positive move," said Alex Neill, its managing director of home products and services.
"However, the Government must guard against any unintended consequences that undermine customer service and push up prices as a whole.
"As it will take some time to come into effect, customers sitting on expensive standard variable tariffs should switch now."