He won't stay in bed

Me and my husband have a little boy we are adopting. He was our neighbors child and he was taken away from them because of severe child abuse that put him in the hospital. I used to babysit him all the time and didn't want him going in the system so we took him an are planning to adopt him as the parents will be serving close to a decade in prison and they are getting rights terminated. He is 6 and he will not stay in bed. He gets out of bed every night to sleep with us. Of course we want him to be comfortable but would like ways to keep him in his own bed.