The Mishna in Avos teaches that Torah study with Derech Eretz is "yafa" - beautiful - because the engrossment in both (continuously) makes us forget sin.
Most of us are not on the level of the saintly Rogatchover Gaon who said about himself that his whole life he was so busy learning, that he didn't have time to think of sinning. Many of us are involved in the more mundane to various degrees.
But we can all create a schedule of constant healthy productivity, be it in holy or relatively mundane matters, that keeps us so busy that we don't have time or mental ability to think of sinning.
This has been very effective for me. I simply make sure to have a full and productive ordered schedule, and do my best to keep to it. The yetzer can only get us if/when we create for ourselves "free time," which is a western and false idea anyway.
Thank you GYE