You will have to set boundaries for yourself and not cross those boundaries. For example, keep your conversation at a point where if either of your mates heard it they would not be worried about you having an affair. You can be his shoulder to cry on and vice versa but you must not cross that line. If you cannot stick to those boundaries then I suggest that friends would not be the best thing for you. You can set the boundaries together or separately but make sure they are boundaries that won't go against the vows you took with your mate if that is truly what you want to do. If you decide to be together it has to be when both of you are single and have found closure in your marriages if you don't do it the right way then you relationship will be built on deceit and dishonesty. It's not going to be easy to think of him all the time as only a friend but with time it will get easier and you have to also ask yourself "Would I want anyone to deceive me or lie to me?" This will hopefully keep you from crossing any of the boundaries.