Make sure you're properly hydrated, fed, and, um, electrolyted.
With those out of the way, try standing in the pedals on a few hills BEFORE you start to get that cramped feeling in your quads. Standing is the only way for me to get complete use from my inner quad muscle - which is the one that gives me grief on hills if I don't extend it completely. You don't have to hammer up the hills - just standing with a cadence maybe half your spin rate (e.g. 45ish if you spin @ 90). You'll probably have to shift to a harder gear when you stand.
Works for me. Might not for you... people are different.