Well..as far as I know, locking gate function was patched to the base game since Pets. It depends on how you made a fence. If you place the fence around the front door only, then it won't work because it's partly placed but if you make whole fence around all your house and put a gate, then it works as long as your patch version is above 1.63. If it doesn't work, it shows the reason why you can't when you hover over your mouse on the gate. When I installed Pets, I always built a fence around whole garden in the yard, and set the gate that only my household can open it for preventing my home garden from wild animals. This is about all kind of gates.
Also as for the celebrity gate, even though your sim is not a celebrity, it's not possible to visit. There's an empty celebrity house in Bridgeport. I put my normal sim in that celebrity house and changed to the active household to other NORMAL sim. That normal sim was not able to visit my the other normal sim in celebrity house. You don't have to lock the celebrity gate. Just do "set as a front door" in Live mode and it will work.
I just want to show how to do with screenshots but it seems like I'm not allowed to post any pictures here.