I say DIY, but I didn't do it myself and it really wasn't my idea, I was just insistent that there had to be a way to make our tension-style baby gate sturdier and kept bouncing ideas off people until my uncle came up with the best idea and my dad put it into effect for me.
This is for the type of baby gates that fit in a doorway with threaded rods on both sides that you tighten against the door frame. I couldn't get ours tight enough that I couldn't just grab it and tilt it, which left me fairly certain that if an adult was falling and reached for it to steady themselves, the gate would move and they would fall down the stairs.
Our solution was to use a drill bit that was slightly larger than the pads at the end of the threaded rods (not a hole-saw, a large drill bit) and drill into the door frame in the four spots where the ends of the rods touched. We put the gate in place first, leveled it and centered it, then traced around the pads, removed the gate, drilled, then replaced the gate and tightened the rods. DONE! No more movement in the gate, so no chance that the baby, the dog, or anyone can get (or fall) down the stairs without opening the gate. The only thing left is to paint inside the holes we drilled, but there's no rush on that. And if we ever want to remove the gate, a little drywall putty and paint will erase the holes.