It typically takes 4-6 months for a puppy to be fully house trained, but some puppies may take up to a year. Size can be a predictor. For instance, smaller breeds have smaller bladders and higher metabolisms and require more frequent trips outside. Your puppy's previous living conditions are another predictor. You may find that you need to help your puppy break old habits in order to establish more desirable ones.
Once your dog can stay in a sit for several seconds, you can begin adding distance. Place him in a sit and say “stay,” take one step back, then step back to the pup, give a treat, and your release word. Continue building in steps, keeping it easy enough that your dog can stay successful. Practice both facing him and walking away with your back turned (which is more realistic).
Set up his private den. He needs "a room of his own." From the earliest possible moment give your pup or dog his own, private sleeping place that's not used by anyone else in the family, or another pet. He'll benefit from short periods left alone in the comfort and safety of his den. Reward him if he remains relaxed and quiet. His den, which is often a crate, will also be a valuable tool for housetraining.
Just as a child needs a caring parent; an athletic team needs a coach; your puppy needs a leader and a clear social hierarchy. If you do not take up the role of leader, your dog will; and you will end up with an unruly, disobedient dog. Many people try to win their new puppy's love by letting the puppy always have its way. Buckets of affection is a wonderful thing for most puppies, but it must be tempered with respect.