I've noticed that in the Gemara you often see a pattern where two people are discussing an issue in front of an Amorah (e.g R' Yirmiyah) while he was asleep. After their discussion he wakes up and gives his opinion. Is there any solid source for why the Amoraim would be conducting a discussion in such a manner?
No sources that I know of, but a couple of possibilities:
It shows how devoted these students were to their teacher - they wanted to be able to study from him at all hours (and, if he wasn't up to teaching, they'd at least be able to review what they had already learned).
Conversely, it shows how devoted the teacher was, that he'd be sitting and teaching his students even to the point of exhaustion and needing a short nap.
In Moed Katan 28a the term מנמנם is used to mean "near death." Conceivably, then, in at least some of these cases the meaning is the same - that R. Yirmiyah or R. Yochanan or whoever was about to draw his last breath but still rallied his energies to teach his students one final lesson.