I kept my little Dash in the crate at night when I first got him, the barking the first few evenings was terrible, but after that he got used to it (I think he knew I would let him out when we woke up!) I continued with the night-time crating until he stopped barking to wake me up to pee (made sure he did this for about a week) after I knew he could sleep through the night, no more crate

and now he sleeps soundly next to me.