Some web based email clients give a "time out" after a while if the account is logged in to, but not in use.
The companies that do this do it because they don't have the storage space to maintain all the sessions.
Google on the other hand has nothing but space. I have gone a past many days without any re-logging in. Direct Internet Connectivity{No-Proxy Server} is a must with appropriate Browser Settings.
Also, sometimes your Browser may auto-flush the cookies and session values. This can be an internal setting or any malware activity.
Perhaps you can elaborate a little more on the Browser you are using; and also on the Internet Connectivity.