Arboreal environments pose many functional challenges for animal locomotion including fitting within narrow spaces, balancing on cylindrical surfaces, moving on inclines, and moving around branches that obstruct a straight path. Many species of snakes are arboreal and their elongate, flexible bodies appear well-suited to meet many of these demands, but the effects of arboreal habitat structure on the locomotion of snakes are not well understood. We examined the effects of 108 combinations of surface shape (cylinder vs. rectangular tunnel), surface width, incline, and a row of pegs on the locomotion of corn snakes (Elaphe guttata). Pegs allowed the snakes to move on the widest and steepest surfaces that were impassable without pegs. Tunnels allowed the snakes to move on steeper inclines than cylinders with similar widths. The mode of locomotion changed with habitat structure. On surfaces without pegs, most snakes used two variants of concertina locomotion but always moved downhill using a controlled slide. Snakes used lateral undulation on most surfaces with pegs. The detrimental effects of increased uphill incline were greater than those of increased surface width on maximal velocity. Snakes moved faster in tunnels than on cylinders regardless of whether pegs were present. Depending on the surface width, the addition of pegs to horizontal cylinders and tunnels resulted in 8–24-fold and 1.3–3.1-fold increases in speed, respectively. Thus, pegs considerably enhanced the locomotor performance of snakes, although similar structures such as secondary branches seem likely to impede the locomotion of limbed arboreal animals. J. Exp. Zool. 311A:207–216, 2009. © 2009 Wiley-Liss, Inc.