Be Your Dog's Everything
If you ever want your dog to behave properly in public or when visitors are about, they need to be emotionally neutral around people and other dogs/animals.
"Emotionally neutral" means - neither excited nor nervous/fearful of people/dogs.
People and other dogs need to be seen as furniture to your dog, not potential playmates or threats.
This is how I can walk the neighborhood or a busy street with my dogs and they don't pull, bark or carry on when they see other people/dogs. People are amazed by this but it's actually simple. They don't care about greeting you. They care about me. They don't want to meet your dog. They care about me. They don't want to be petted. They care about me. They don't need to play with other dogs. They have ME.