I experienced this with my first, 14 years ago. Since then, with the three kids that have followed, we installed the Tall White Metal baby gates. The best are the ones made by Summer Infant. They are unclimbable. You just tighten it to fit the door frame. This allows you to hear whats going on and for the child to not be afraid if you were to shut the door. Initially, they will jump out of bed and run to the door crying, this is just drama to get you to come in and "rescue" them. Simply walk back in, put the child in bed and say, It's bed time sweetie. The second time, Walk back in, put the child in bed and say, you need to go to bed. please stay in your bed
The third time, walk in, calmly say, No, bedtime. The fourth time, put them in bed without saying a word and close the door. They will learn that if they stay in bed, the door stays open, but either way, you will leave and they are required to stay there. The child might stand at the gate and shake it crying for a little bit the first few nights and might even fall asleep on the floor. The important thing to remember is your intelligent child is trying to see if different behavior might change the situation. They can NEVER win. If crying and drama for hours ends in positive results for your child, the next night he will feel like he needs to do this again and again and when you finally decide to not give in, you will have a genuinely upset, frustrated child because his plan isn't working which will cause him to be hysterical and you to break down your self with guilt. It is always better to decide your rules and stick to them no matter what. This build strong confidant kids who can count on positive boundaries. I leave the gates up until my kids reach about 3 1/2. Or when they are old enough to go potty in the night on their own and return to their own beds. PS. Saturday mornings are so nice now. We have a rule, you can get up and potty, I hand her a sippy cup of ice water and some dry cherrios and she had to play in her room until we get up. She quietly plays dollhouse or with her other toys in the morning for hours. It's wonderful. This being said after 14 years of being forced to get up early every day for children. The gate is also a great way to make sure a napping child stays napping while you shower or garden. You can often find the gates on craigslist for half price.