Species–environment relationships are often studied at large spatial scales, but effective conservation requires an understanding of local-scale environmental drivers and pressures. Widespread degradation and fragmentation of forests have increased the proportion of tropical mammal habitat that is affected by edge effects. Edge effects include greater exposure to anthropogenic disturbance and abiotic changes that synergistically influence how well populations can cope with climate change. We investigated relationships between distance to the forest edge, forest structure, microclimate and terrestrial mammal detections in a selectively logged forest at the boundary of Gunung Leuser National Park in Sumatra, Indonesia. We collected mammal detection data from motion-activated camera traps, microclimate data from automated climate data loggers and forest structure data from vegetation plots. Daily mean and maximum temperatures significantly decreased with distance from the forest edge, whereas tree height and minimum temperature increased. Mammal diversity was lower at the forest edge compared to the interior. Mammals were detected less frequently at the forest edge, although this relationship varied between mammal orders. Mammal detections were best explained by temperature, tree height and tree diameter at breast height. These results demonstrate that abiotic changes in forests brought on by edge effects have negative impacts on mammals, but these effects vary between mammal taxa because of differing sensitivities to human disturbance. Our findings highlight the importance of considering local-scale environmental drivers in determining species–environment relationships to identify key habitat features such as microclimate refuges that should be prioritized in ecosystem management.