Since I just had to re-remember how to do this, I thought I’d post a quick note. To keep SSH sessions alive you just need to create a file: .ssh/config. In this config file you can just add:
Host *
ServerAliveInterval=60
KeepAlive=yes
This works on the relatively recent (last 3-5 years) versions of OpenSSH that come with MacOS X. There’s probably a similar mechanism in older/other versions of SSH, but I haven’t researched it too deeply.