I've been single female for a large part of my adult life, and it's no fun having no decent male company coz they either get a thing for you, or (mistakenly) think you have a thing for them. For a while I completely gave up, coz friendships with guys seemed to have a max 12 month shelf life, so it seemed a waste of investment...
Then I discovered the key - it works if the man is *happily* married...!
If the wife feels well-loved (I'm talking about "affection" guys, not just sex!) by her man, then she doesn't see you as competition.
If the guy is head over heels for his woman, he doesn't cross his mind that cheating on her might be an option.
Of course, I make a point of making friends with the wife too, once the friendship gets to a certain level, but the primary friendship remains with the guy...
Edit: to qualify - when I say 'happily married' I'm also including other LTRs, in case that needed mentioning....
and... I'm assuming a certain moral character in the guy, an assumption that loving your wife excludes cheating, coz that's a criteria I like in my good friends... And the happy+morals does seem to give those guys a 'blindness' to there being anything more to the friendship than friendship...