Environmental filtering is deemed to play a predominant role in regulating the abundance and distribution of animals during the urbanization process. However, the current knowledge about the effects of urbanization on the population densities of terrestrial mammals is limited. In this study, we compared two invasive mammals (dogs Canis lupus familiaris and cats Felis silvestris) and three indigenous mammals (Siberian weasels Mustela sibirica, Amur hedgehogs Erinaceus amurensis, and Tolai hares Lepus tolai) in response to urbanization using camera trap distance sampling (CTDS) in the rural–urban landscape of Tianjin, China. We used generalized additive mixed models (GAMMs) to test the specific responses of their densities to levels of urbanization. Invasive dogs (2.63 individuals/km2, 95% CI: 0.91–7.62) exhibited similar density estimations to cats (2.15 individuals/km2, 95% CI: 1.31–3.50). Amur hedgehogs were the most abundant species (6.73 individuals/km2, 95% CI: 3.15–14.38), followed by Tolai hares (2.22 individuals/km2, 95% CI: 0.87–5.68) and Siberian weasels (2.15 individuals/km2, 95% CI: 1.06–4.36). The densities of cats, Siberian weasels, and Amur hedgehogs increased with the level of urbanization. The population densities of dogs and cats were only influenced by urban‐related variables, while the densities of Siberian weasels and Amur hedgehogs were influenced by both urban‐related variables and nature‐related variables. Our findings highlight that the CTDS is a suitable and promising method for wildlife surveys in rural–urban landscapes, and urban wildlife management needs to consider the integrated repercussions of urban‐ and nature‐related factors, especially the critical impacts of green space habitats at finer scales.