You mostly wait it out. Every invasion runs on a timer — roughly 7 to 11 minutes — and once that expires the Cogs retreat on their own, no matter how many are still on the street.
The exception is a Mega Invasion, which is triggered on special occasions and can last for hours. Those you simply have to ride out.