I think it follows the rules, but it has too many commas... Thanks! I asked him if the fact that his ex-girlfriend was getting married made him sad, and he truthfully said no, but having his friends be close to not telling him at all, did.
There's no limit to the number of commas you can use, but that sentence is confusing and kind of ugly, particularly after the second comma. I would rewrite it as more than one sentence.
You could keep it simple. I asked him if the fact that his ex-girlfriend was getting married made him sad? He said no, but his friends not telling him did.