Two studies, in the journal Science, linked specific species and the overall diversity of the microbiome to the effectiveness of immunotherapy drugs.
Experts said the results were fascinating and held a lot of promise.
Our bodies are home to trillions of micro-organisms and the relationship between "us" and "them" goes far beyond infectious diseases.
The microbiome is involved in digestion, protection from infection and regulating the immune system.
Both studies were on patients receiving immunotherapy, which boosts the body's own defences to fight tumours.
It does not work in every patient, but in some cases it can clear even terminal cancer.
One study, at the Gustave Roussy Cancer Campus in Paris, looked at 249 patients with lung or kidney cancer.
They showed those who had taken antibiotics, such as for dental infection, damaged their microbiome and were more likely to see tumours grow while on immunotherapy.
One species of bacteria in particular, Akkermansia muciniphila, was in 69% of patients that did respond compared with just a third of those who did not.
Boosting levels of A. muciniphila in mice seemed to also boost their response to immunotherapy.
Meanwhile, at the University of Texas MD Anderson Cancer Center, 112 patients with advanced melanoma had their microbiome analysed.
Those that responded to therapy tended to have a richer, more diverse microbiome than those that did not.
And they had different bacteria too. High levels of Faecalibacterium and Clostridiales appeared to be beneficial, while Bacteroidales species were bad news in the study.
Tissues samples showed there were more cancer-killing immune cells in the tumour of people with the beneficial bacteria.
The team then performed a trans-poo-sion, a transplant of faecal matter, from people to mice with melanoma.
Mice given bacteria from patients with the "good" mix of bacteria had slower-growing tumours than mice given "bad" bacteria.
Dr Jennifer Wargo, from Texas, told the BBC: "If you disrupt a patient's microbiome you may impair their ability to respond to cancer treatment."
She is planning clinical trials aimed at altering the microbiome in tandem with cancer treatment.
She said: "Our hypothesis is if we change to a more favourable microbiome, you just may be able to make patients respond better.
"The microbiome is game-changing, not just cancer but for overall health, it's definitely going to be a major player."
Mark Fielder, president of the Society for Applied Microbiology and professor of medical biology at Kingston University, said the study showed the importance of understanding the micro-organisms that call our bodies home.
He told the BBC: "It's really interesting and holds a lot of promise, we need to do more work but there are exciting glimmers here in treating some difficult diseases.
"Some claim the microbiome is the answer to everything, I don't think that's the case.
"But once we understand more, it could be that microbiome manipulation is important in changing people's health."
Dr Emma Smith from Cancer Research UK, said: "It's fascinating.
"One of the big challenges for using immunotherapies to treat cancer is understanding which patients will respond, and this research is a step towards helping doctors to identify these people."
More about: #cancer