All the commandments: You shall not commit adultery you shall not kill you shall not steal you shall not covet and so on are summed up in this single command: You must love your neighbor as yourself.
If you cannot work on the marriage or the women is a moron staying married and cheating makes the most sense because divorce is disruptive to the family life and your bank account.