There are a few things that have worked really well for me.
1. I plan before I go to the store. I get the flyer for the grocery store I always shop at emailed to me each week, and I think about what I already have and what I'd like to make and then I make a list. I find that I'm less likely to buy things that aren't on the list, and I'm also less likely to forget something and then have to make another expensive trip to the store!
2. Invest in storage containers!!!! Good, freezer safe containers in a variety of sizes and ziploc bags. This has been my salvation for a couple of reasons. First, I am WAY more likely to pack healthy meals and snacks when I don't have to search and search for something to put them in. Second, freezing things when I make too much (like pasta sauce, for example), or when I buy something I can't or shouldn't eat all of (like bread or bagels) means that I always have something healthy in the freezer AND keeps me from wasting. And third - you mentioned produce. Storing it properly will keep it fresher. Also I always cut up the whole fruit or veggie at once and then store it - it's always easier to convince myself to eat that whole cucumber if it's already cleaned and chopped, and then I don't throw it away.
3. As for going out, everyone has made brilliant suggestions about eating beforehand and planning, etc. I do those things too, depending on who I'm out with. Another thing that I do, though (and this will only work with certain crowds), is share. Sometimes it's legitimately splitting something with someone. In my case, it's going out with my guys and immediately putting a portion of what I ordered on one of their plates. Because they will eat it! Or, if I am eating more than I'd planned, I stop and share it with them. Thank goodness for athlete boys with ridiculous appetites! Another thing that works is agreeing to go to a place you don't like. The aforementioned guys love going to Hooters before going to baseball games, and it works perfectly for me! I enjoy the tackiness, have one drink and a ton of laughs and am completely unfettered by the food, since I don't like chicken wings or curly fries!