Everybody else has covered this pretty well, but let me add this:
Having the friend in this position should make it easy to identify what it is you're not getting from your wife. Since you know what you're getting from the friend to fill in the holes in your marriage, it becomes a matter of finding a constructive and tactful way to indicate to your wife that you need these things from her. And be prepared to accept that she probably needs things from you that she's not getting.
You say you've been having trouble for 2 years, but you don't say how long you've been married. You also don't say what the issues are that keep cropping up. That's your business and I sure don't expect you to describe them in gory detail on a public forum.
When my wife and I had been married about 10 years, we had issues that lasted more than a couple years. Part of that was the stress of raising 2 kids, and working full time, etc. Hell, we've now been married for 20 years, and we still have issues... but at all times, no matter how bad the flareups, we had fundamental compatibility. That's not to say there were not fundamental differences that caused a lot of stress, but there were no dealbreakers. Neither of us cheated, had unaddressed addiction problems, gambled, ran up the credit cards, etc. We're both headed in pretty much the same direction even if we take somewhat different paths at times.
There were plenty of times when we both felt it would be easier not to be married, but (at least on my part) there were never any times when I felt that I needed to completely removed from her in order to survive (mentally and physically). We've always had fundamental respect for each other, even if sometimes failing to actively apply that respect led to arguments. We've both become better at actually listening, and at examining our own actions, and at changing our behaviours to give each other what they need. After 20 years we have never been more happily married than we are now.
I guess my point is that 2 years is not a long time if you both feel you are fundamentally compatible, but just have certain things you need to do better for each other. Give it another 2-3 years of effort (it will NOT be a direct upward route to improvement) and revisit the situation as you go. BUT: if there is a real, fundamental incompatibility that is truly not resolvable, then the time is now to start to disentangle yourselves as adultly and humanely as possible. Of course, only you can decide that.
Hopefully all of these posts are helping. Good luck, and remember we are here to help.
[edit] One last thing - I see the friend as a symptom, not a cause or a cure. If you decide to separate from your wife, you owe it to everybody NOT to immediately pursue the friend, at least for a time. That would be a great way to make a bad situation worse. Give it some space and see if that is something real before going there.