Launch Terminal from your Applications > Utilities folder.
Execute the following command into the Terminal window...
sudo nano ~/.ssh/config
Enter your administrative user password when prompted.
Add the following line to your ssh config file.
Press Control+x to exit, then press Y when prompted to save changes.
Press Return to confirm the filename and exit.
New SSH connections should now stay open indefinitely. You can shorten or lengthen the interval as required by your server.