I would offer different advice: “Try to stop feeling guilty about it instead, and the dreams may stop on their own.” Even if the dreams don’t stop, without the load of guilt that they add to your psyche you won’t feel bad when they occur.
It’s normal, natural and not unhealthy to have dreams – even highly charged and erotic dreams – about someone (or more) who is not our lawful partner. That’s even going to happen from time to time in highly committed marriages (and other partnerships) such as you have described. If it’s “normal” and “natural”, then the best thing that you can do is stop giving it space in your head in two ways, first by doing it in the first place, and second by feeling bad about it. (It’s the second way that’s hurting you.)
It’s part of life, and it’s not “bad”. Accept it – even feel free to enjoy it on occasion. (Many marriage counselors will tell you that it’s okay to fantasize about another even while you’re in the act of making love with your partner. Maybe you feel differently, that ”their okay is not my okay”, but I don’t think that they’re making a value judgment about its okay-ness, only its mental and emotional health okay-ness.)
If it adds any credence to my argument, my wife and I were together for over twenty years before we separated – and she left me. For the record, and if it lends any credence to my argument, I fantasized a lot about others from time to time during our marriage, yet I never cheated and never once even kissed or touched another woman sexually. She was the one who left me – when she thought that I was about to start cheating (which I still never did) – and she was also the one who cheated on me, as she confessed to me at the 10-year mark.