If your friend is suicidal, listen to him. No matter how dark it gets. Don't try to talk him out of it, otherwise he might shut up from you not taking him seriously and be in real danger to himself alone. The fact that the conversation exists means it's helping.
People kill themselves when they no longer feel they have control over their lives to end their pain. On top of that might be shame, guilt, despair, or grief but the lack of control is the underlying reason. Attempting to talk them out of it takes what little control they have left and heightens suicidal feelings. Many have made this mistake and lost their friends.