There are a few common reasons people get logged out when they don't expect it.
1. If you sign in on more than one computer you can sometimes become signed out. Make sure you sign out of any computer you are done using to avoid accidentally becoming signed out.
2. If you sign into a second account in the same browser it can cause you to become signed out of one of the accounts. Make sure that only one account is signed in at a time.
3. If you have disabled cookies it will prevent you from being signed in. We store your sign in information in a cookie, so you should make sure cookies are enabled in your browser.
4. Certain errors will cause you to become signed out. This is currently a bug in Scratch and the solution is to just sign in again.