Many animals move using lateral undulations, but snakes are noteworthy for using this type of locomotion in an unusual diversity of environments, including trees in which both the spacing and orientation of branches vary considerably. Despite branches providing discrete locations for snakes to generate propulsive forces during lateral undulation, the consequences of branch spacing for the locomotion of snakes are poorly understood. Hence, we determined maximal speeds and kinematics of an arboreal snake (Boiga irregularis) crawling on horizontal and vertical cylinders with pegs that simulated different spacing between secondary branches. Peg spacing, perch orientation, and their two-way interaction term had widespread, significant effects on both performance and kinematics. For the horizontal surfaces, maximal locomotor speed occurred with intermediate peg spacing, and it was nearly twice as fast as for both the smallest and largest peg spacings. By contrast, the locomotor speeds of snakes on the vertical surfaces were unaffected by peg spacing, and they were uniformly slower than those for the horizontal surfaces. For both perch orientations, the number of pegs touched by the snake decreased as peg spacing increased, and while touching only one peg the snakes crawled with apparent ease and steady speed. The snakes crawled vertically with only one peg as quickly as they did using 2-10 pegs. Pegs on a horizontal cylinder are probably important both for propulsion of snakes and preventing long-axis rolling, whereas pegs protruding from vertical cylinders and those protruding from horizontal planar surfaces are probably used almost exclusively for propulsion.