I had this problem too. Dogs need their sniffing time, but they can’t rule the whole walk.
These days I do three things to help her understand when she can sniff and when not to.
First, I trained her to pay attention and come to me on walks. I would say “Riki!” and if she looked at me she got a treat. Then I would say “Riki, lets go” and if she came to my hand she got a treat. I found that rewarding the behaviour you want is the quickest way to train them. After a few weeks of this, she came to me whenever I called.
Second, I would show her who is boss without being negative in any way. I kept the leash shorter and walked at my own pace – this is my “walking mode”. I do this for about ¾ of the walk (any more and she starts getting ideas). I also make sure to “start as I mean to go on” so I would always spend at least 10 minutes at the start of the walk in “walking mode”. If she started to lag behind I would call her over and treat her. If she wouldn’t come, I would continue walking insistently but gently, without tugging or yanking, until she got the message. At first, whenever she came to me, I would treat and praise. Eventually I’ll thin this out so she moves towards the behaviour I expect, and treat her only when she comes quickly or with little resistance.
Thirdly, I always give her at least 15 minutes to sniff and explore. I pay attention to her in “walking mode” so she can go toilet if she needs to, but other than that she gets her sniff time and that’s that. When she learns some more manners I might increase the sniff time, but she’s a VERY sassy, self-willed dog so I have to limit it at the moment!
Last of all – please pay attention to WHY your dog is sniffing. They could be nervous and using sniffing to show they’re not a threat. Check and see if your dog sniffs around anything in particular – for example, people approaching, a strange object, cars, buses, other dogs. You might notice that they’re nervous around something in particular, and that desensitising them to this can help with it. My dog Riki HATES the rain, and she is always extra “sassy” when the rain is out. She’s trying to tell me she doesn’t want to be out, she’s really sorry, look how harmless she is, she doesn’t want to be out can we go back now please. She’s also scared of walking with other people (like my mum or friends) so she sniffs extra then to show she’s not a threat.