I know many people who have tried. But no one who has succeeded in the long term .
They all end up cheating again, in one way or another.
The men ( and sometimes their wives too) kid themselves that they had the affair because of some external factor. She was available, they were lonely / having a mid life crisis, wife wasn't paying them enough attention, wife put on weight or got ill, their granny / hamster died, they were depressed - the list is endless but predictable.
When the real reason they had an affair is their huge sense of entitlement. Otherwise they would have left their supposedly crap marriage and then met someone else. They never do that because they want to have their cake and eat it.
That belief ( that’s it’s fine to lie and cheat as long as you have A Reason ) never goes. So when another Perfectly Good Reason comes along, they cheat again.
New reasons can include “ my wife was angry at the affair “ and “ she didn't get over my affair within the timescale I had allocated “ .
Counselling never seems to address this entitlement - it’s the elephant in the room. It’s all about how the one who was cheated on can do better next time. And how the poor cheater was just a helpless victim of circumstances.
Even the men who initially seem grateful that they were forgiven eventually become angry and resentful, if they remain in the marriage. Because they believe deep down that they were forced to stop their cheating by their wife / fear of losing their money / fear of having to parent their own kids and do their own domestic labour.
Either their evil wife stopped their fun when she found out. Or the evil OW treated him badly by dumping him. It’s never their fault.
If you have no agency in a situation, how can you stop it happening again ? You can’t.
( I’m not talking about a drunken kiss at a party BTW, I’m talking about sustained and deliberate cheating. That’s not due to circumstances, that’s about someone’s character ).