I have been through this too, my 4.5 year old still comes into my bed sometimes but we have a king size bed and if she annoys me i take her back into her bed.

I found with my DD1 who was in our very small double bed every night that it took 2-3 nights of constantly taking her back into her bed until she got the message. We made a fuss of making her room really pretty etc with new doona cover. It is so frustrating but we had to get tough as nobody was getting any sleep.

The gate may work, then you can hear him crying and you can go back and settle him into bed again.

Good luck!!!!