I don't know if this applies to everyone, but I think the easiest way to stay healthy is also the most boring: Routine.
If you get into the habit of doing some exercise as soon as you wake up in the morning and right before you go to bed, it will become a natural part of your routine. And if you allocate specific times for going to the gym, the same will apply.
Yes, the it'll be hard to stay motivated at first, but once you start repeating it every day for a few weeks, you'll soon start to feel weird when you don't do those things.
Being methodical with what you eat can also help.
Most of us don't go out in search of unhealthy food to eat. Instead, we "find ourselves" in the situation where it is an easy option.
For example, if you have to put together a quick bite to eat at the last minute, you are less likely to worry about what you're eating - or you may even opt for a takeaway or fast food delivery.
If, at the beginning of the week, you prepare a list of 21 meals that you plan to eat - and then do shopping that will cover those meals. You'll be able to stick to a healthy diet much more easily because you won't have the option or temptation to stray.
Same goes for snacking. If you take into account that you may need a snack now and then, you can prepare a selection of healthy options (dried fruits, nuts, fresh fruit) - rather than relying on grabbing a quick donut on the way to work or a chocolate bar on your lunch break - you can whip out a healthier alternative.
Finally, a powerful motivator is doing a diet with a friend. Going to the gym together, food shopping together, having meals together... This way, if one of you slips up, the other will be there to make them feel guilty :)