If you are in the U.S., you can call the national suicide-prevention hotline, and they can give you some guidance about what a friend can do who is scared for a friend. The number is 988.
So your friend is hurting himself, and is thinking about "giving up". I'm assuming this means ending his life?
This means you have to tell someone. I don't know who that would be - his parents, a teacher, the police, your parents, a combination of the above, but trusted adults need to be told.
Your friend may get angry with you - that's okay. You have to decide that saving your friends life is worth more than saving the friendship right now.
This is above your skill level. It's above mine, too - he needs trained mental health professionals, maybe trained law enforcement professionals.
What you can do in the meantime is remind him that it's okay for him to say no. That he doesn't have to give in to her because he's afraid of whatever her threats are. Maybe she's threatened to reveal photos, or secrets, or she's threatened violence. He can go to the police. The police have dealt with this stuff before.
And tell someone. Tell a trusted adult/authority figure everything you know, and save your friend.
Best of luck to you both.