Unless you have an explicit need for a ControlMaster, remove the entries
- ControlMaster
- ControlPath
- ControlPersist
They are fun, but they have some downside issues of their own. And if you are not hooked on the service they provide, just remove them as they are not important to maintaining your ssh connections.
Change ServerAliveInterval to 240 and change ServerAliveCountMax to 2 (you can use a larger value, but 2 should really be sufficient.
- ServerAliveInterval 240
- ServerAliveCountMax 2
The value of 3,000 for your ServerAliveInterval interval is too long (50 minutes). You need something shorter, so 240 seconds (4 minutes is a better choice, or make it shorter still if you like; I would not go below 60 seconds).
Second, DO NOT let your Mac go to sleep, as that will break any ssh connections you have active.
A Mac laptop will go to sleep as soon as the screen is turned off when you are not connected to power. So you can use System Preferences -> Battery -> Battery -> Turn Display Off After, and move the slider to the right so your screen stays on longer.
If you are plugged into power, then you can use System Preferences -> Battery (or it might be Energy Saver if on an iMac or Mac mini) -> Power -> [X] Prevent your Mac from automatically sleeping when the display is off
You can also look into utilities such as "Amphetamine" via the App Store that can be configured to keep your Mac from going to sleep.
NOTE: At work we use ssh extensively and the 240 and 2 values work great, plus making sure the Macs do not go to sleep while connected.
NOTE 2: At work I (and a lot of others) use tmux on our remote systems so that when our ssh connection is broken, the remote session is still alive. If you are more comfortable using the older but still capable GNU screen, that is also available for various Unix/Linux based operating system. In fact many Unix/Linux distributions actually include GNU screen. Only a few distributions include tmux, but I find it invaluable to keep my remote sessions up and running even when I have to disconnect (because of VPN into work shutting down once every 24 hours, or sleeping my Mac at the end of the day, or weather related network/power interruptions at home, etc...). tmux has been a life saver. Lots of YouTube videos on tmux if you are not familiar with it. tmux stands for Terminal Multiplexer.