The distribution, diversity, and assembly of tropical insects have long intrigued ecologists, and for tropical ants, can be affected by competitive interactions, microhabitat requirements, dispersal, and availability and diversity of nesting sites. Arboreal twig‐nesting ants are limited by the number of hollow twigs available, especially in intensive agricultural systems. Ant diversity and abundance may shift along elevation gradients, but no studies have examined if the proportion of occupied twigs or richness of arboreal twig‐nesting ants vary with elevation. In coffee agroecosystems, there are over 40 species of arboreal twig‐nesting ants. We examined communities of twig‐nesting ants in coffee plants along an elevational gradient to answer the following questions: (1) Do species richness and colony abundance decline with elevation or show a mid‐elevation peak? (2) Does community composition change with elevation? (3) Is elevation an important predictor of change in ant abundance, richness, and relative abundance of common species? We surveyed 42 10 × 10 m plots in 2013 from 450 to1550 m elevation across a coffee landscape in Chiapas, Mexico. We sampled a total of 2211 hollow coffee twigs, 77.1 percent of which were occupied by one of 28 species of ants. Pseudomyrmex simplex was more abundant in lower elevations, whereas Pseudomyrmex ejectus dominated in high elevations. Species richness and the percent of occupied hollow twigs both peaked at mid‐elevations (800–1050 m). In sum, we found that species richness, abundance, and composition of arboreal twig‐nesting ants shift with elevation. These findings may provide important insights for understanding ant communities in coffee agroecosystems