If your dog pulls ahead stand still until the lead goes loose before walking on. Treat him when he stays by your side. Persist, because if you give in and let him pull ahead he will take you where he wants to go, which rewards him with what he wants and ensures that he will do the same next time too.
Call his name to get his attention and make it fun to follow you. Change direction and encourage him to follow with a treat. Every time he stays next to you say “yes” or “good” and give a treat. This makes it clear that you want him to walk next to you.
Next encourage him to sit next to you every time you stand still. Stop walking, say “sit” and give a treat when he sits. Eventually he will sit when you stop even without a reward. This is vital near roads and bicycle paths.