I find that pre-ride hydration, conscious drinking of fluids during the ride, and consumption of electrolytes (I use Hammer Endurolytes; 3/hr) helps. I keep a stopwatch timer going on my computer to remind me to drink every 10 minutes. If it’s hot, I need to up the electrolyte dosage.