Riley left before Joyce died and before the reveal about the big bad being a god, so they're hardly relevant to the discussion.
Xander is repeatedly noted as being the one who really DOES know what's going on, since he's not distracted by magic powers or Slayers skills, he's human. He's the one who talks her out of her funk when she started feel self pitying in her first days at college. He talks to her about the Riley situation.
He is able to talk to Buffy as voice of reason because he doesn't judge her choices, he doesn't force his opinion on her (and knows it would be ridiculous to try) but he makes he reconsider her own choices in a way no one else can. He loves her, but ultimately as her big brother rather than a lover. So yes, he didn't need to know all about the Riley situation, he'd heard Riley's side, and he'd heard Buffy's and he asked Buffy to search her own feelings to make SURE she wasn't making the wrong choice.