Enabling keepalives usually works for me too. If the connection still drops, it could be the server settings or network issues. You can also try adjusting the interval for keepalive signals to a lower value for better stability.
I regularly maintain SFTP connections for several days and even weeks. If keep alive doesn't work I would assume your ISP or the fact your connection is bad is the culprit.
Long connections often exit
It takes a long time to reconnect every time
Especially for servers with slow network speeds
Always waiting for a long time on this interface
Need to maintain a long connection
Even if it wastes network resources