To keep up with his accustomed routine and also to avoid having him develop 'nest syndrome' by spending 24/7 eating/sleeping and living in the same cage I'd say keep him in your bedroom.
1) He's accustomed to sleeping nearby you 'the flock'. So you can't just suddenly push him out and abandon him into the dark so to speak. Personally, Jacko sleeps either right next to my head on her tree or she sleeps on my pillow. Of course, this means I've got to wash the sheets more often

but I like it, she likes it and she no longer plucks. She enjoys cuddling my nose and falling asleep while we watch tv---of course she moves higher up once she knows I'm asleep.
2) You can't all of a sudden lock him in a cage--if he's accustomed to sleeping 'free' all night then stick to it. You can try what Liz suggested and give him his own box/pillow/bed etc but I wouldn't suddenly lock him up at night. I don't think it does best by the bird's instincts and needs.
The safety thing is a bit overrated IMO. If it was that much of a concern I think any Chihuahua or baby or cat who slept in a bed with someone would die. It does happen, of course, but its pretty rare. Given how you can't make everything 100% safe without taking the 'zest' out of life and living in a bubble---I think the sense of security, love and routine that sleeping as a flock gives our birds is worth any potential accident.
I can say this that there have been times where i've passed out (darn meds) with Jacko snuggled next to me underneath the blankets (as a rescue she was toweled rough so this helps build a more positive association). My partner mentioned that I never moved a muscle while she was next to me. Eventually she crawled out of the blankets, flew back to her cage and then flew back to beak me hello when I woke up

This has happened a few times and minus some instances of birdie poop under the blankets (YUCK) she's a-ok. There is the birdie poop factor but I usually just place a towel under her and she sleeps on it so any birdie poop ends up there.