Some reasons I can think of:
1. Your internet connection is not stable at certain time in your area (maybe at night), and so the fluctuation in connectivity disconnects your game, although your computer would still remain connected to the Internet. It just takes a few seconds of Internet disconnection to cause the game to log off. Once logged off, the game does not auto-connect itself when Internet connection is resumed. If this were the case, nothing you can do about it because this relates to your ISP.
2. Your computer is set to sleep after a certain period of time of perceived inactivity. Thus, when you are not doing anything else on the computer, just a game screen opened and your char is afk drilling on it, which requires very little work taking place on your computer system, the computer may think you have become inactive, and so will go to sleep, which will disconnect your game. If this were the case, set your computer to never sleep.
3. You have things, some apps, or some websites, running open in the background, and maybe they take up most of your computer resources/capacity, so something has to give. Your computer may then decide it's your game that needs to be sacrificed. If this were the case, I'm not sure what to do. Maybe increase your RAM. Or close down some apps, or close the open websites.
4. Sometimes, updates to something on your computer can cause improper running of the computer. For example, some time last year, an update of my antivirus, Malwarebytes, caused my game to become unplayable. I had to put my game into exclusion in the antivirus to be able to play it. Subsequent updates of Malwarebytes fixed the problem and this issue is no longer a problem now. If you suspect your antivirus may be a problem, put the game folder into exclusion.
From time to time, clear your computer of things like browsing histories and cache to clean your computer and free up capacity.
Other than that, I am not really sure what to do about your problem. I wish you luck in solving your issue.