How do you prevent this from happening? Never eat at a restaurant again or you can try this! After you place your order ask the server when they bring out your food to also bring a to go box. Take half of your food and put it in the to go box and the other half eat it up. Now you have just cut your calories in half and still got to go out and enjoy a meal with a friend. The other plus is you now have a great lunch for tomorrow.
Be smart when you order too, no French fries get a side salad, fruit or veggies. Have water to drink or ice tea with 2 lemons, no soda. Skip the rice and double up on the veggies if you have to have the baked potato just eat half, if you have to have it? Go ahead and share the desert it's better with a friend anyway.
Remember it's not just the calories to worry about but also the salt they use to cook with. Too much sodium will do you no good and its the best way they like to add flavor to your food.
Take this bit away with you don't eat it all get half to go right away you will feel better about your dining out experience.
All the best.