If you are getting logged out 1 of two thing is happening=- most likely you have not clicked/ticked the box "keep me logged in until I log out" - in which case the cookie that lets you stay logged in is expiring while you are using it base don time and activity.
The other possibility is if you are using bookmarks or sometimes links that are supposed to go to another post/section of the site if the link is not the same format as you are logged in (with www in front, or without www- however it is set when you initially logged in) then some reason the cookies do not recognize it as still being logged on. That happens to me when i click links in some posts too and unfortunately have not managed to find somebody to rewrite the htaccess file to correct that situation ....