This Yahoo! help article covers the changing of that setting as well as several other possible issues. The main thing I would look at, though, are your cookie settings...what browser are you using, is it set to delete cookies when you close your browser, do you use third-party software that deletes cookies, etc. If the cookie is being deleted then your session would be lost, regardless of your Yahoo! preferences.