The microbiota is composed of commensal bacteria and other microorganisms that live on the epithelial barriers of the host. The commensal microbiota is important for the health and survival of the organism. Microbiota influences physiological functions from the maintenance of barrier homeostasis locally to the regulation of metabolism, haematopoiesis, inflammation, immunity and other functions systemically. The microbiota is also involved in the initiation, progression and dissemination of cancer both at epithelial barriers and in sterile tissues. Recently, it has become evident that microbiota, and particularly the gut microbiota, modulates the response to cancer therapy and susceptibility to toxic side effects. In this Review, we discuss the evidence for the ability of the microbiota to modulate chemotherapy, radiotherapy and immunotherapy with a focus on the microbial species involved, their mechanism of action and the possibility of targeting the microbiota to improve anticancer efficacy while preventing toxicity.