This has happened to me on occasion when I'm sufficiently tired. One time I pulled an all-nighter before a transcon flight. I know I slept the majority of the flight, but I'm not sure how many hours exactly. It wasn't very sound sleep because I remember waking up a couple times, but I'm not sure for what. I also have a vague recollection of being offered snacks and a drink. After the flight the guy next to me commented that I seemed to have slept well.