I think the best way to resist temptation is to avoid it as much as possible. Don't buy junk food. If it's not around, you can't eat it. I take it a step further and use online grocery shopping (pickup or delivery) so I don't even have to go into the store. I shop mostly from my favorites lists that only contain healthy foods. On the rare occasion I go into the store, all of the temptations are in my face and I find myself tempted to buy something I shouldn't, "just this once." The more you have to face temptation, the more mental effort it takes to resist and the more likely you are to give in.
Another thing that helps is having healthy, delicious foods readily available. If you like to cook, go on Pinterest to find healthy recipes that you look forward to trying. I live alone, so I always have a lot of leftovers that I freeze in individual portions, so I have a variety of healthy meals that I can easily grab from the freezer and heat in the microwave with some cauliflower rice. I meal prep a bunch of salads every week and have a variety of Skinny Girl salad dressings on hand. I eat a lot of sugar-free Jello with sugar-free meringue (made with pasteurized egg whites so it's safe to eat raw), and sugar-free meringue cookies. I also eat protein bars (Built Bars are my favorite) as a healthy-ish treat.
This is so important, and it's really easy to take for granted once you lose the weight -- to forget how hard it is to live with morbid obesity. I recently saw a guy at work who was so big that he looked like he was struggling to walk out to the parking lot, and my heart broke for him because I remember being that big. I don't really think about it much anymore, but there was a time that I dreaded walking to and from the parking lot or up a couple of flights of stairs because it was so hard when I was carrying an extra 200 pounds. And that's not to mention all the social stigma on being fat, which I never want to experience again.