How do I patch a medium size hole so that I can install a baby gate securely?
Since you're going to fix the drywall anyhow, you could cut out a section of it and install a piece of wood blocking across the inside of the studs to fasten the baby gate hardware to. (The picture you posted looks like you used pocket-hole screws to attach the board to the wall so I'm thinking you could make use of pocket holes to attach the board between the studs.)

Something like this (disregard the notes on the image pertaining to steel studs. The concept is the same for wooden ones):


Then replace the drywall and attach the baby gate to the wood through the drywall patch. This not only gives you something good and strong to attach the baby gate to, it also makes it much easier to patch the drywall because there's something solid behind the patch to hold it. Also, when the baby gate comes down, the screw holes can be filled and nobody will know the blocking board is in the wall.