Mary (the other player) can risk her own safety to try to save Bob.
I'd make the stakes clear -- "You are risking falling yourself" -- then ask for one or more checks.
I like the "one roll to successfully grab" then "one roll to not be pulled off the bridge yourself".
---
So part of the point of RPGs is telling a story. How can we maximize the story for minimal mechanics here?
Present dilemmas. Like:
Ok, when you grab, are you going to risk yourself?
No: roll with disadvantage. (when you tell the PC this, they may change their mind. Let them. Encourage heroics!)
Yes: Make a check. If you fail, say "they are out of your reach and you are teetering on the edge. Do you hook your foot on the bridge and dive for them, or try to save yourself?" (instead of "roll with advantage", we ... tell more story!)
Hook your Foot: Try again. On success, you are both saved. (here we have a cinematic moment, where the PC caused it to happen, with real consequences if they didn't.)
Save Yourself: Try again, with advantage. On success, you alone are saved. (flinching from risk. Will Mary hate herself?)
On failure, you both fall.
You got a hold of her. See if you are pulled off. Are you going to risk yourself to hold on?
No: Check with disadvantage, on failure you let go and Bob falls (if you don't give it your all, sometimes you could have done more)
Yes: Check, on failure you are pulled off bridge as well. (make it clear there will be no second rolls here, especially if you gave one before)
On success, you save Bob.
The point of this is to offer clear stakes, and give a PC the chance to sacrifice herself (or risk it) to save another. Even if the result is "nothing happened, nobody fell", a story was created, where the "Mary" PC made choices, and the "Bob" PC witnessed Mary risking herself for him. Or the "Mary half-heartedly tried to save Bob", or "Mary risked herself, then flinched". All are great stories. (And what will Bob feel if he survives?)
You'll note I placed multiple spots where Mary can choose to play it safe, and I didn't punish heroics. Playing it safe is far less likely to succeed in every case.