As I understand it (surely someone on HN has more exposure to this than I do; I've lost friends, but not myself experienced the impulse):
The "do's": listen, empathize, stay calm, be hopeful in tone, vector them towards help.
The "don'ts": argue them out of it, get emotional, judge, try to fix it yourself.