Thanks so much to everyone for their advice.
I do need to clarify something, though (sorry, I obviously wasn't as clear before as I meant to be): I really don't mean for the cats to go outside at all unless it's with a harness and leash on in the backyard when someone else is there. My problem is that they lie in wait and dart out the door when you open it, either to go out yourself or for someone to come in. We're usually really good about commanding them (insofar as cats can be commanded) to stay put or by blocking the space with a foot, but every so often they do manage to scramble out, or a visitor accidentally leaves the door open.
They're both also really good jumpers: I've seen them do a standing 5.5 foot jump: scared the living daylights out of me! So I don't imagine the baby gate will work, unfortunately.
A friend of mine who is studying to be a vet just told me that I can have an electric fence put in, and what matters is the strength of the collar put on the animal. So I can put collars of a different level onto my cats than I do the larger dog. I'm hoping this will work, and will return and post again with what I find.
PS: there's no back door: there is a side door, but it doesn't lead to the backyard. We actually have to take a little path to get to the back yard from the side door!