The world is facing a hard battle against soil pollution such as heavy metals. Metagenome sequencing, 16S rRNA sequencing, and quantitative polymerase chain reaction (qPCR) were used to examine microbial adaptation mechanism to contaminated sediments under natural conditions. Results showed that sediment from a tributary of the Yellow River, which was named Dongdagou River (DDG) supported less bacterial biomass and owned lower richness than sediment from Maqu (MQ), an uncontaminated site in the upper reaches of the Yellow River. Additionally, microbiome structures in these two sites were different. Metagenome sequencing and functional gene annotations revealed that sediment from DDG contains a larger number of genes related to DNA recombination, DNA damage repair, and heavy-metal resistance. KEGG pathway analysis indicated that the sediment of DDG contains a greater number of enzymes associated with heavy-metal resistance and reduction. Additionally, the bacterial phyla Proteobacteria, Bacteroidetes, and Firmicutes, which harbored a larger suite of metal-resistance genes, were found to be the core functional phyla in the contaminated sediments. Furthermore, sediment in DDG owned higher viral abundance, indicating virus-mediated heavy-metal resistance gene transfer might be an adaptation mechanism. In conclusion, microbiome of sediment from DDG has evolved into an integrated system resistant to long-term heavy-metal pollution. (C) 2018 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license.