Edit your /etc/ssh/sshd_config file and add the following to the server’s configuration …
ClientAliveInterval 120 ClientAliveCountMax 240
… restart your SSHD process.
This alone should stop the issue, but if you have a ~/.ssh/config file to help your connections along you can add the following to any troublesome nodes
ServerAliveInterval 240