"he behaved like a bastard but he isn't a bastard."
Are you familiar with the phrase 'handsome is as handsome does', OP? Or maybe 'actions speak louder than words'? Or the one I've read on MN many times, 'when someone tells you who they are, listen to them'?
To behave like a bastard, to be able to actually go through with the actions of a bastard; to not turn away from those behaviours/actions through conscience, morals, empathy, or even just a desire to be able to look yourself in the mirror and not see a bastard; you do actually have to be a bastard.
To go back to 'when someone tells you who they are, listen to them' - I really think you need to have a look at who he's told you he is.
"He did repeatedly try and talk to his wife about the issues in their relationship but nothing changed. Their relationship wasn't bad enough for him to want to leave and they had kids as well. He didn't set out to cheat on her but he did try and improve things between them before he cheated. "
"She didn't make time for them as a couple once they had their kids and she didn't think there was a problem."
I doubt his wife told you these things, they must have come from him.
To me, it reads as if he expected children to make no difference to his life and his nose was out of joint when they did. He had to share his wife's attention with his children, and he didn't like it. Children, especially in the early years, are very time-consuming. They're exhausting. Perhaps his wife would have had more time if he'd done more of the parenting? The issues in their relationship were all his.
So, he's told you that if he's not the centre of your world, he'll cheat.
"He said it was no strings fun as the marriage had gone stale."
"He wanted a bit of excitement and wasn't getting it at home."
So he's told you that you need to make it exciting for him. Or he'll go outside the home.
"He says it's different with me and he hasn't got any reason to stray."
Well, it is different because he married her and not you, he has made even less commitment this time. And that sounds a lot like a warning to me - you are on notice not to give him reason. It's been two years. Do you think it might be getting stale for him yet?
So he's told you he'll stray when he decides he has 'reason'.
I think you have been naive, and now seeing your friend so hurt, you are waking up to your naivety and look at things with fresh eyes. This is a good thing, and hopefully you will be better able to protect yourself from now on. And with those fresh eyes, I would urge you to look at two things anew:
"I did think what you don't know doesn't hurt you."
I hope you are now wondering what you don't know about. And please think about what BertPuttocks posted (21:46:28) about the hurt felt without knowing - so true.
"I do believe we're happy enough together that he's not prepared to take the chance that he could fuck up our life together."
I expect his wife thought that too. And he was prepared to fuck up their life together and the lives of his children for the sake of 'excitement'. 