Thank you for your question. There are a number of strategies a person can employ to avoid sins, but the most important is to realise the reality of sinning. It is the knowledge of what sins really are, and their damaging effects in this world and the next that will keep a person away from any type of sinning. The more that knowledge increases, the more distant a person will be from sin until they reach a level of infallibility.
As for adultery a person should think about its ends in this world and the next and compare those ends to the fact that God has provided a halal and upright way for sexual pleasure. They should avoid all of the actions that are prerequisites to adultery such as attending the wrong kind of places and having the wrong kinds of conversation which will lead to such sins. They should be careful of their imagination as it is the imagination that makes the sin look better than it ever is. A factor of sin is anticlimax, as all sins are never as good as their imagination, whereas the reward of not sinning in the next world is better than anything that can be imagined.
May you always be successful