You can add the following to your local /etc/ssh/ssh_config file (man ssh_config):

 
ServerAliveInterval 60

Where 60 is in seconds. This will cause your client to send a message to the SSH server every 60 seconds which should keep the connection alive.

Another good resource for setting from the server side:
https://www.godaddy.com/help/how-to-set-an-ssh-timeout-12300