Although a rich record of Pleistocene human-associated archaeological assemblages exists, the scarcity of hominin fossils often impedes the understanding of which hominins occupied a site. Using targeted enrichment of mitochondrial DNA, we show that cave sediments represent a rich source of ancient mammalian DNA that often includes traces of hominin DNA, even at sites and in layers where no hominin remains have been discovered. By automation-assisted screening of numerous sediment samples, we detected Neandertal DNA in eight archaeological layers from four caves in Eurasia. In Denisova Cave, we retrieved Denisovan DNA in a Middle Pleistocene layer near the bottom of the stratigraphy. Our work opens the possibility of detecting the presence of hominin groups at sites and in areas where no skeletal remains are found.