Just don't buy rich foods over which you have no willpower.
Don't go down those aisles in the supermarket. Don't keep biscuits (by which I mean cookies) and snacks in the house at all.
Don't buy "meal deal" lunches that give you a discounted fizzy drink and snack.
It's all very well people telling others that they need to develop willpower over knowing when they've had enough, etc., and I admire people who can do that. But it's just a lot easier to exercise that control at the point of purchase.
And never, EVER go food shopping while hungry, for more than just lunch. Try to buy/order your lunches before you get hungry.