You can change the time that the IB Gateway auto disconnects.
You can also configure IB Gateway to automatically reconnect each night. This way you only have to reset the connection once per week which is far less annoying.
Instructions here: https://www.systematic-investors.com/ib-gate-disconnects-from-apm/
Yes I should be clear, I wrote my own, I don't use it. But every Sunday I still need to start a fresh instance for whatever reason.