Although none of these are foolproof, there are some steps you can take that might help you stay logged in. If you're using the browser version, be sure to only login from a single browser, and disable any extensions you might have activated on that browser.
As strange as this may seem, it's also recommended that you click on ads frequently when you log in to Instagram, because it suggests to them that you might be a valuable user.
Adblockers seem to be the culprit for many users, which makes sense. Instagram wants to be able to advertise to you and thinks you might be suspect if you have an adblocker set up. Disabling that and other extensions has helped some people navigate the issue, although it hasn't been a fix for everyone.
You may also want to set up two-factor authentication on your Instagram account, both because it's a good security practice and because it will make your account appear more secure.
Unfortunately, though, there isn't an easy solution to this issue except for trying repeatedly to convince Instagram to believe that you are a real person and not a bot. These steps will certainly help, but it may take time, and it may not be a permanent fix. As always, you can reach out to Instagram directly as well to see what help they might be able to provide.