The key is to steadily build up your endurance. I did a 27 mile charity ride at the weekend, which is the furthest I've ridden so far. We took it fairly easy and stopped for a few minutes at the two water stops en route. Next time I'll look for a route of 35 miles or so. Hilly terrain will have the same effect as a longer ride, since you have to work harder to climb the hill, and don't quite regain that effort on the downhill side.