Crate training or getting a puppy pen teaches your puppy to stay in a space quietly playing or napping.
Make sure to be consistent about setting rules with your new puppy, so they don’t get confused or forget.