Marital infidelity comes in many forms, and doesn't always include a sexual indiscretion. In the case of an emotional affair, you have taken a certain intimacy you normally share with your spouse and used that to connect with another person. Your focus has shifted outside of your marriage, even though you may not act on any attraction that you feel. Odds are this is a person who was a friend, and that line of propriety has begun to blur with a deeper, emotional attachment. Even though you want to recommit yourself back into your marriage, you still want to recapture and maintain that original friendship. Whether you can accomplish this depends largely on the dynamic of your marriage and the maturity of all involved.
Come clean. An emotional affair flourishes under a certain ambiguity that suggests as long as you are not crossing any physical boundaries, you are not cheating. Cheating is, in fact, doing anything that you cannot share with your spouse. So share it all, with both parties, and be honest about your desire to maintain a more appropriate friendship with the outsider.
Establish boundaries. Any flirtation must stop, and this includes secret emails, calls or texts. Maintain a conversation with your friend that you could openly share with your spouse. Also decide with your spouse how much "alone time" is appropriate with your friend, and respect your primary relationship as the authority when establishing these ground rules.
Change your habits. Consciously avoid all those pitfalls where you may be tempted to resume inappropriate behavior with your friend, including time alone or time online. It isn't fair to anyone involved to leave any door like this open for the future.
Reinvest back into your marriage and yourself. That emotional affair filled a hole, whether conscious or subconscious, and if you don't repair it you are likely to fall back into destructive patterns despite your best intentions otherwise. Don't rely on outside influence to fix what is wrong within yourself or your primary relationship.
Know when to walk away, even if it is just to take a temporary break. You may have some serious work to do within your marriage or on your own fulfillment and self-esteem. A true friend will give you the space you need to properly compartmentalize your feelings until you can resume a more appropriate relationship.