The densification of urban landscapes reshuffles plant--pollinator interactions and affects the provisioning of pollination services. Improving local-scale habitat quality, e.g. planting more flowers in urban greenspaces such as gardens, has been proposed to compensate, but effective pollination also depends on trait-matching between pollinators and flowers. In an experimental study, we used four phytometer species with differing flower-visitor specificities to assess pollinator visitation, richness, and pollination success along independent gradients of landscape-scale densification and local-scale floral richness. Pollinator visitation and richness declined both with increased densification and lower floral richness. Flower-rich gardens supported more small solitary and large social bees, but not hoverflies, beetles, or small social bees. Pollination success declined with densification but was compensated by floral richness only in phytometers with more specialised pollinators. While increasing local floral richness may support pollination success of plants with specialised visitors in dense urban landscapes, generalists may require additional conservation measures.