Long rides require good technique as far as using all your available muscles as efficiently as possible. Using power all the way around the stroke and increasing your cadence somewhat often helps to spread the load instead of relying only on the big muscles. Spinning is good training for this.
In the early part of the season I sometimes get cramps in the muscle on the upper inside of the thigh (not being a medical person I can't tell you which muscle that is) and they usually come in the middle of the night after a long and/or tough ride. What a way to wake up

Hopping around trying to straighten up in excruciating pain!
Stretching after a ride helps. In my case I need to sit on the floor with my back straight and the soles of my feet together. Using my hands to slowly draw my feet toward my crotch and pressing my knees down as close as possible to (or on) the floor.. No jerks or fast pulls. When I get the feet as far in as possible I bend over slowly from the waist as far down as possible and the hold it motionless for 30 seconds. This stretches the exact place that I have trouble with.
I used to think that I was cramping there because my saddle was cutting off circulation, since I don't think these muscles get used that much in the pedalstroke but I've tried so many different saddles that I doubt that's the problem. Any sport therapists out there? Anyone else have the same trouble? It goes away after the first few rides of the season.