generally, sleep before class. There are some occasions আপনি just can't stay awake but there is really nothing আপনি can do no matter how hard আপনি try...
Try having some coffee before the boring class commences. আপনি will not only drive away the sleep but also remain alert and ask প্রশ্ন and actively participate in the classroom to ensure that আপনি are on শীর্ষ of your attention. If it's not possible to have coffee before the class, then, take a quick break to the সাজঘর and splash some water on your face and have a chewing gum and return to the class. Sit up straight, feet planted flat on the floor. Don't lean back অথবা slouch in the seat,don't rest your chin on your hands, etc. If you're in a posture that discourages sleeping, it will be easier to stay awake. Try and focus on the lecture. Take notes. Maybe skim a little ahead in your textbook so আপনি have an idea of what the lecture will be on. Listen for key words অথবা ideas আপনি saw in the reading..