get enough sleep. consider changing your schedule (getting up EARLIER to adjust your alert/drowsy periods.) make sure the meal before the class includes fiber, protein and a bit of fat which will digest slowly, which doesn't take as much energy as a fast digesting meal. Do jumping jacks or run right before class. Just a few minutes that get you huffing and puffing will help open airways, oxygenate tissues, pump some blood, and might alter consciousness enough to keep you awake. if you put your head down (fold yourself in half while standing) and get more blood in your head, it might help. If you carry a thermos type bag for lunch, take a cooling pack to class, and put it on feet, hand, etc, rotating it to other parts as needed. carry a menthol 'inhaler' and take a whiff. citrus essential oils can work as well. put a thick rubber band on your wrist and flick it frequently hard enough to wake yourself up. put something like a tennis ball against your spine between your shoulder blades and the chair, and make yourself keep it there the entire class (hard to sleep if you are aware of such a thing.) I haven't tried that one but had a classmate who used it. I also know soeone else who swore by eating super spicy food before/during class. hard to sleep if your head's on fire.
an easier (and more educational tactic) is to preview the info for class and see if you can come up with some questions and 'seek' out the answers during lecture. You could also, if your allowed to ask questions, try to come up with ones that will stump the professor.