Why do people cheat? Do we cheat because we're bored, misunderstood, seek adventure, or miscommunication with a spouse or significant other?
If cheating is borne out of boredom, get a hobby, take a class, or work longer hours, read a book. I had a teacher who once chided a classmate after he'd said something was boring: "Boring indicates a small mind; the word is tedious!"
I don't think small-minded people are capable of cheating; it takes cunning, scheduling, and maneuvering to successfully cheat. Should you realize your partner is tedious, do something about it rather than flirting with a co-worker, creating a provocative dating profile, removing your wedding band, or cultivating online emotional relationships and affairs.
There are any number of hobbies you can participate in to avert wandering eye syndrome. Separate yourself from temptation. Deliver yourself from the woman with the undulating hips, the man with devil may care smile. Gardening, bowling, or golfing are soothing hobbies that could serve as the water to extinguish a spark or burning flame in the heart or seat of your pants.
The same goes for continuing adult education. Take a night or weekend class if you feel particularly vulnerable while your mate is otherwise occupied (see above note on boredom).
Enough can't be said on the powerful world of [good] books. I'm not advocating cowardice by encouraging you to read, but quite the opposite. It takes a strong person to resist temptation. If your love life lacks sizzle, read Anaïs Nin, Henry Miller, or other famous erotica authors and academic texts.
When the urge strikes, and it probably will a few times over a lifetime, think about how you'd feel if were the one who's been cheated on and refrain from any such thoughts. Jog a few miles around your nearest lake, pond, or reservoir, followed by a cold shower if all else fails. Hopefully you'd be too exhausted to think about anything else. Hopefully you won't encounter anyone on the running course.