It said the "irresponsible" advert for meal delivery service Diet Chef implied happiness and self-confidence could only be achieved through weight loss.
The advert featured a woman, Cheryl, before and after using the service.
Edinburgh-based Diet Chef said the advert showed her sense of achievement after taking control of her lifestyle.
It said the actor who played both versions of Cheryl had a Body Mass Index of 27.4 when she played the earlier version, which was in the overweight category.
In the advert, the later Cheryl tells her former self: "I know how you feel; you can look that good again, you know," and "I bought a bikini last week, for the first time since this picture."
The former Cheryl says: "You look amazing. I never dreamed I could be that slim again."
The Advertising Standards Authority (ASA) received complaints from 26 viewers objecting that the advert was irresponsible for exploiting women's body insecurities by implying that they needed to be slim to be happy.
Complainants also said it implied that overweight women did not take care of themselves or how they looked.
The former Cheryl was shown wearing a baggy shirt and had messy hair, while the current, happier Cheryl had a more polished appearance.
Diet Chef said the ad showed the frustration of the former Cheryl, who did not feel able to make a change in her lifestyle or to maintain a controlled diet and so was surprised that she had done so, and the sense of achievement of the later Cheryl.
It also said the advert's approach was typical of the "before and after" genre commonly used to advertise weight loss products.
The ASA said the advert did not give the impression that former Cheryl had neglected her personal appearance and said viewers would be unlikely to find this part of the advert offensive.
But it said the character's unhappy demeanour while talking about wearing a bikini appeared disproportionate to concerns about her weight, especially as she did not appear to be particularly overweight.
The ASA said the advert "implied that weight loss was the only solution to her problems".
It went on: "It therefore implied that those with insecurities about their bodies, and particularly their weight, could only achieve happiness and self-confidence through weight loss.
"We therefore concluded that the ad presented a socially irresponsible approach to body image and breached the code."
It ruled that the advert must not appear again in its current form and told Diet Chef "to ensure that their products were advertised in a socially responsible way".