The most I've ever hiked in a day was 28 miles, on a long-distance hike where
achieving a "marathon" day (26 miles or more) was sufficiently infrequent among
hikers as to be worth mentioning. That was in the mountains and with a
heavy backpack, so I would expect Gandalf would do better unladen on the
plains.
Some people cite 4 m.p.h. as a normal walking rate, but that's actually a good
clip--2.5-3 m.p.h. is more like it. Still, if Gandalf left near dawn and
returned near dusk, in high summer and pretty far north, he'd have a minimum of
14 hours walking, and if the trail he followed was clear and didn't slow him
down, he could probably easily manage 40 or more miles, as you say.
A long-winded way of agreeing with
you.