Limit your overly friendly interactions with people of the opposite sex online. Don't engage in flirty conversations that can lead to improper situations. Also, be honest with your partner about your online activities, so that there is no room for suspicion. If you feel that an online relationship is starting to cross the line, cut it off immediately.
In addition to these, work on strengthening your real - life relationship. Spend quality time with your partner, communicate openly and often, and show your love and commitment. When your real - life relationship is strong, you are less likely to be lured into potentially unfaithful online situations.