If you don't click the 'keep me logged in' or 'remember me on this computer' or whatver the check box is called when you log in, you automatically get logged out after X minutes of inactivity. While you compose a post nothing is being communicated to or from the website - you're inactive. Apparently, by the time you click the 'submit' button, you have reached X minutes of inactivity and are getting logged out.
You can either click the check box to keep you logged in or get in the habit of copying everything you were going to post to the clipboard before you post (in case you have to log in again.)