Il Casello Magico by Norton Juster

A bored, apathetic boy receives a mysterious tollbooth that whisks him into a whimsical, logic-bending realm where he teams up with a watchdog who keeps time and a cast of eccentric guides to journey through lands that personify words, numbers, and sounds; facing absurd obstacles and clever puns, they confront the forces of ignorance, rescue the banished princesses who embody reason and rhyme, and return transformed with a renewed curiosity and appreciation for learning.