Removing ads means the makers of anti-vaccine videos can't make money of their videos the way other YouTube creators can.
YouTube said on Friday it was removing ads from running on some anti-vaccine videos, claiming that the videos violated its policies against "harmful or dangerous" acts.
The videos had been brought to YouTube's attention by BuzzFeed News, which reported that some ads had slipped through the platform's automated system meant to enforce YouTube's content rules.
BuzzFeed said that some advertisers objected to their products being associated with vaccine opponents.
YouTube said its policies already prohibited ads from appearing on videos that promote anti-vaccination content, meaning the makers of the videos couldn't make money off them the way that other YouTube video creators share in ad revenue.
"We have strict policies that govern what videos we allow ads to appear on, and videos that promote anti-vaccination content are a violation of those policies," YouTube said in a statement on Friday.
"We enforce these policies vigorously, and if we find a video that violates them we immediately take action and remove ads."
Among the companies whose products were advertised on anti-vaccine YouTube videos were a vitamin seller, a discount drug company and a software firm, BuzzFeed found.
Like other tech companies, the Google-owned video service has struggled with how to handle conspiracy theories, misinformation and other questionable material posted to YouTube by users and sometimes recommended by its own algorithms.
YouTube does not prohibit anti-vaccination videos outright, but this month it said it would no longer recommend videos that come close to violating its community guidelines, such as videos that promote phony miracle cures or claim the earth is flat.
Declining vaccination rates have led medical professionals to warn about risks posed by the return of infectious diseases. Pockets of opposition to vaccines have provided fertile ground for the measles virus to take hold, including in New York, which has seen the worst outbreak of the disease since the 1990s.
YouTube is facing a separate protest from corporate advertisers after reports that some videos featuring young children included comments from alleged pedophiles. AT&T, Nestlé and Epic Games are among those that have withdrawn ads.