The principles of this answer can be applied to other addictive disorders than eating disorders.
Let us suppose there are two people in your head fighting for power: Sara junior and Sara senior (choose your own name). Sara senior will have some order in her eating habits but Sara junior only thinks about immediate satisfaction and completely ignores the consequences. While Sara senior has decided to stop eating chocolate and buns, Sara junior can gladly stuff herself with biscuits and chocolate without thinking about what the future effect will be. Sometimes one is in power and sometimes the other.
In order to be successful, it is necessary to understand how these two sides function. Sara junior is strong and often wins in a confrontation. Sara senior is more cunning and can win by being prudent. For example: Sara senior travels home from her job by train. There is a kiosk at the station where she buys chocolate every day, even though she knows that she shouldn't. One day she decides not to have any money with her when she goes to work. Sara junior gets angry when she realises there will be no chocolate but can't do anything about it. When Sara senior comes home she eats a sensible dinner and is proud that she has outwitted the food monster inside her.
Sara senior soon becomes so used to not eating chocolate on the way home that she is able to take money with her without spending it at the kiosk. Sara senior has become stronger and can overcome Sara junior.
John is another example. He used to wake up every night and eat without restraint. However sensibly he had eaten during the day, he destroys the good effects by eating at night. If he had no food at home, he went out and bought some. His neighbour Britt learned about this and promised to help him. When John had eaten his supper, he locked the kitchen door and pushed the key and his wallet through Britt's letter box. In the morning she pushed it back through John letter box. During the day John had good control over his eating and after some months he could manage without Britt's help. He had become used to not eating excessively at night. Of course, the first nights were not easy, but he gradually got used to listening to the radio if he couldn't sleep.
It was extremely tempting for both Sara and John to give way to the impulse to eat excessively but they felt much better psychologically and physically when they had become used to regular, nutritious meals instead of eating in order to reduce anxiety.