As a dude, I accepted that the thoughts of cheating will always entertain me.
When the thought of cheating comes through my head, I just jack off. I think back on if the sacrifice of being in a good relationship is worth it. It's not and I take that as a self esteem boost.