Don’t let him stop and sniff the other dog, just keep walking. You might have to jerk (very gently) on the leash a bit – give it a brief snap with your wrist and keep walking.
One technique BarkBusters taught me was called attentiveness training. This basically teaches the dog to heel and ignore everything except the person walking him. We used a very long training leash, but this can be done with your standard 6’ leash. (I am not a fan of retractable leashes unless it’s a tiny little dog because it’s much more difficult to control a dog with those things and they shouldn’t be allowed to be walking out in front of you anyway. That teaches the dog that he is the leader; it’s supposed to be the other way around. YOU are the leader. Teach him to follow you.)
So you start out in an open space and give the dog all the leash leeway you can. Hold the looped end of the leash loosely at your chest level, right in front of you. Don’t look at the dog, don’t talk to the dog, just take a step or two forward. The dog will follow and then will try to do what dogs do, which is, he will try to lead you. You want him looking up at you for cues on what direction you’re going in next. The second he steps out so his head is past your feet, abruptly change direction. Do a 180º. This will cause you to jerk on the leash a bit and he will be forced to follow you to keep up. If he’s walking alongside you, with his head in line with your feet, or behind your feet, give him a “good boy” in a chirpy, high-pitched voice and keep walking. Walk slowly, don’t worry about trying to go anywhere. At first, you’ll only get a couple of steps before you have to change direction. So it’ll look and feel like you’re pretty much just walking in two-step circles for about ten minutes. Keep doing this: take a step or two and when the dog steps out in front of you, change directions and keep walking. He will run to keep up. When he steps out ahead of you, change directions. Lather, rinse repeat, until the dog keeps looking up at you to try to see where you’re going next. You have to glance down at the dog to see if he’s looking to you for leadership, and if he catches you looking at him looking at you, give him a good boy. When he does what you want, i.e., quietly walking next to you, head aligned with your feet, and the leash is hanging down like a J shape, give him a good boy the second you observe this good behavior. Otherwise, say nothing. Don’t scold, pull, and say no – that’s just a power struggle and the dog is mostly winning.
The BarkBusters trainer had me do this for about 10-15 minutes with my 75-pound American bulldog and by the time 15 minutes was up, my dog was heeling beautifully, glancing up at me for direction every few seconds and suddenly, our walks became ever so much more fun. There are certain dogs on her walk route whom she cannot resist trying to go visit. It’s like she’s got a little dog posse she has to check in with every day. But other dogs on a leash, she might strain to try to go meet, but she knows we’re walking, not stopping and sniffing, so she’ll keep going. Other dogs, she’s learned to completely ignore. Dogs will watch you for cues once they learn you are the leader and are watching out for them. If you ignore the other dog/mailman/flowerbed/cat/little kid in a stroller, the dog will too.
You might also check out the BarkBusters website to see if they have any instructional video on this technique. Or try searching on “BarkBusters attentiveness training” on YouTube – maybe there’s a demo. I tried to explain it thoroughly in writing but I really couldn’t grasp how it worked until the trainer demonstrated it for me and I tried it myself. You have to react very quickly because if 30 seconds go by and you haven’t corrected bad behavior or reinforced good behavior, it’s already too late.
Another technique you can try, in the house, to teach the dog who is the leader is to always make him follow you from room to room. Never let the dog go through a door first. When you put the leash on and you’re ready to go outside, make him sit and stay before you open the door. No sit, no walkies. Anything and everything the dog wants – food, sniff a butterfly, whatever – must be earned by sitting and staying when told. When you get up from the couch to walk to the fridge and the dog is following, stop at the door to the kitchen and make him sit and stay. Then take a step into the kitchen and let him follow.