How to help my depressed friend?

My friend has been going through a lot recently, family problems, relationship issues, bullying, and more. Things have been overwhelming for him, and in the past few days, it’s gotten out of control. Today he had an anxiety attack in front of me. Also he hasn’t slept for two days. I’m really worried because he even talked about ending his life.

What should I do?