Derived large-mouthed snakes (macrostomatans) possess numerous specializations in their skull and lower jaws that allow them to consume large vertebrate prey. In contrast, basal snakes lack these adaptations and feed primarily on small prey items. The sequence of osteological and behavioral modifications involved in the evolution of the macrostomatan condition has remained an open question because of disagreement about the origin and interrelationships of snakes, the paucity of well-preserved early snake fossils on many continental landmasses, and the lack of information about the feeding ecology of early snakes. We report on a partial skeleton of a new 3.5-m-long snake, Sanajeh indicus gen. et sp. nov., recovered from Upper Cretaceous rocks of western India. S. indicus was fossilized in association with a sauropod dinosaur egg clutch, coiled around an egg and adjacent to the remains of a ca. 0.5-m-long hatchling. Multiple snake-egg associations at the site strongly suggest that S. indicus frequented nesting grounds and preyed on hatchling sauropods. We interpret this pattern as "ethofossil" preservation of feeding behavior. S. indicus lacks specializations of modern egg-eaters and of macrostomatans, and skull and vertebral synapomorphies place it in an intermediate position in snake phylogeny. Sanajeh and its large-bodied madtsoiid sister taxa Yurlunggur camfieldensis and Wonambi naracoortensis from the Neogene of Australia show specializations for intraoral prey transport but lack the adaptations for wide gape that characterize living macrostomatan snakes. The Dholi Dungri fossils are the second definitive association between sauropod eggs and embryonic or hatchling remains. New fossils from western India provide direct evidence of feeding ecology in a Mesozoic snake and demonstrate predation risks for hatchling sauropod dinosaurs. Our results suggest that large body size and jaw mobility afforded some non-macrostomatan snakes a greater diversity of prey items than previously suspected on the basis of extant basal snakes.