Hello Ohmy,
If he still seems quite upset about his wife, you can say "my heart goes out to you". Some might find it a little effusive, though.
If the distress is abated, you can simply say "I'm very sorry to hear about your wife".
(I would not recommend "please restrain your grief", except where you intend a rebuke.)
Best wishes,
MrP





