The government is to impose a UK-wide pre-9pm ban on TV adverts for food high in sugar, salt and fat.
Products affected include chocolate, burgers, soft drinks, cakes, sweets, ice cream, biscuits, sweetened juices, crisps, chips and pizzas.
There will also be new rules on online promotion, but firms selling junk food will still be able to run websites.
A total ban on online adverts was proposed last year, but this has been scaled back after consultation.
The TV restrictions come after Boris Johnson made tackling obesity, which affects more than a quarter of UK adults, a priority for the government.
Food companies have said outlawing any form of junk food advertising - worth hundreds of millions of pounds a year - is disproportionate.
From the end of next year, TV adverts for junk food - also including breakfast cereals, yoghurts, ready meals, chicken nuggets and battered fish - will be allowed only between 9pm and 5.30am.
Commercials for "less healthy" meals out will also not be shown outside this period.
The rules will apply during live and on-demand programmes and will not affect companies with fewer than 250 employees, such as local curry houses, pizzerias and sweet-makers.
An around-the-clock ban on online junk food advertising will be limited to paid-for content, meaning companies can continue to promote goods using their own blogs, websites, apps or social media pages.
A senior advertising industry source told the BBC the TV and online bans would apply to products, rather than wider brands.
So, for instance, Gary Lineker could still appear in adverts for Walker Crisps if they featured items which were deemed to be healthy, they added.
The Department of Health said the restrictions would not affect some foods high in sugar, salt or fat - such as honey, olive oil, avocados and Marmite - as these were not seen as contributing significantly to childhood obesity.
Speaking on a visit to a military base in Aldershot, the prime minister said: "I'm afraid we do have a national struggle with obesity, and we need to deal with it...
"Let's get a grip on it. Sending out a signal in the way we treat advertising is entirely right."
The UK population's weight has risen since the early 1990s, with more than 60% of the adult population now overweight or obese, according to NHS Digital.
Problems often begin in childhood and those from the most disadvantaged backgrounds are most likely to suffer, research suggests.
The government says it is keen to prevent young people consuming too many unhealthy products and since 2018 manufacturers have had to pay extra tax on high-sugar drinks.
In 2006, Mr Johnson defended mothers who - in spite of efforts by TV chef Jamie Oliver to improve school meals - were reportedly pushing fatty foods through school railings to their children,
"I say let people eat what they like," he said. "Why shouldn't they push pies through the railings?"
But his views have changed, particularly since he was hospitalised with Covid-19 last year.
Mr Johnson said obesity was one of the "real co-morbidity factors" associated with the disease, adding: "Losing weight, frankly, is one of the ways you can reduce your own risk from coronavirus."
But the Institute of Practitioners in Advertising - which represents the large ad agencies - has said the government's own impact assessment shows a watershed ban on high-fat, sugar and salt food and drinks would only remove around 1.7 calories per day from a child's diet - the equivalent of half a Smartie.
Sue Eustace, public affairs director of the Advertising Association, said her industry was "dismayed" and that jobs would be lost in broadcasting and online publishers.
However, Charmaine Griffiths, chief executive of the British Heart Foundation, called the advertising ban "a bold and very positive step", adding that it was "one important part in building a more healthy environment where the healthy option is the easy option".
For Labour, shadow health minister Alex Norris said: "This ban alone will not be enough. We need a radical obesity strategy in this country that goes further, ensuring families are able to access healthy food, supporting local leisure facilities and tackling child poverty."
The NHS says most adults with a body mass index (BMI) of 25 to 29.9 are overweight, while those with a BMI of 30 to 39.9 are classed as obese.