Training your dog to soundly sleep takes a lot of patience and training just like with anything else. Puppies will need more training than adult dogs.
Take your dog out before bed as their bladders especially puppies aren't like ours nor do they understand holding it in which can be unhealthy for dogs.
Dogs will sleep 12 - 13 hours a day, here and there, therefore setting up a constant routine that involves, play, eating and washroom breaks sets a proper sleeping and daily schedule.
Set up a cozy sleeping area for your dog designated only for bed time.
Wear he/she out. In addition to walking, through a toy around the house for a while to get the energy level up so that he/she is tired for bed.