You probably noticed that words like "prison," "ward," "bail," "jail," and "pent" show up all over the place between lines 9 and 12. What's up with all this imprisonment language? Well, the Speaker uses an extended metaphor (a.k.a. a conceit) to compare his relationship with his mistress to being a prisoner. In other words, the dude feels trapped and powerless in the love triangle and can't seem to escape, even though it makes him miserable. Of course, being a prisoner of love is a pretty common metaphor in courtly love, but Shakespeare's use of it is a lot more graphic and a lot more disturbing than what we're used to seeing. Even Shakespeare scholar Stephen Booth thinks that "the metaphor is so complete, so urgent, so detailed, and so flatly matter-of-fact (jail, line 12), that the lovers, their situation, and their behavior become grotesque."
Line 9: This is where the speaker imagines that his heart is imprisoned inside his mistress' heart, which he calls a "steel bosom's ward." Yikes. Why is he comparing her heart to a jail ("ward"?) It seems like he's saying that her emotions are as cold and hard as metal ("steel")—sort of like the "steel" bars we might find in an actual prison cell.
Lines 10-11: The speaker continues the heart/jail metaphor but now imagines that his friend's heart is also a prisoner that needs protection from the mistress. When he offers to "bail" his friend's heart, we can read it a couple of different ways. 1) The speaker is offering to "bail" his friend out just like someone might offer up bail so an inmate can avoid jail time. (If this is the case, it seems like the speaker is offering to sacrifice himself to the mistress so she'll stop hurting his buddy.) 2) Since the word "bail" can also mean to confine or imprison, it seems like the speaker imagines his heart as a little jail within a jail. (If this is the case, our speaker's fantasy is to have his friend all to himself.) Either way we read it, the speaker clearly wants to keep his friend away from his mistress and close to him.
Line 12: When the speaker says his mistress can't "use rigor [in his] jail," he makes her sound like a hardcore prison warden who likes to be strict ("use rigor") with her inmates. That's pretty unflattering, don't you think? There might also be a raunchy pun on the word "rig" here. According to critic and scholar Stephen Booth, "to rig" meant "to have sexually." So, maybe our speaker is threatening to withhold sex from his mistress? Or, maybe he just wants his friend to stop sleeping with her? Maybe both?
Line 13: When the speaker says he's "pent in" his mistress, he means a couple of different things. On the one hand, he's continuing the extended metaphor he started back at line 9 to reaffirm that he's always going to be a prisoner to her love. On the other hand, he's also describing what it feels like to be literally and physically "pent" inside of her during sex. So, why's he's comparing her vagina to a jail cell? Because he wants her to know how powerless he feels (like a prisoner) when they're hooking up, especially as he climaxes and gives her "all that is in" him.