Something I forgot to mention: a single tilde goes to the outermost SSH session. Type successive tildes to send the escape sequence to inner sessions. For example, let's say I SSH from my workstation to a jump host, then from the jump host to the destination.
Return-tilde-dot would be caught by the outer SSH session from my workstation to the jump host, and that session will be terminated.
Return-tilde-tilde-dot would be caught by the inner SSH session, from the jump host to the destination, and that is the session which would be terminated.
I don't know of a good way to index in the other direction, so to send commands to the innermost session, you have to remember how many sessions you have outside it. This isn't generally too big a problem, as long chains of SSH connections are fairly rare.