I'm new as well, but the one thing I thought of regarding my own situation when reading your post was after the bout with the OW. The two things I failed at where 1) addressing the issues that caused the affair and 2) repairing the loss of trust that resulted from the affair.
In my case, we just brushed it under the rug, she said she was sorry, I got even more insecure, and we muddled thru a few more years before things started breaking again.