There was a video going around You Tube a while back of a man being mauled by a Labrador after he had gone to it and rubbed it's exposed belly. The key being that the dog had walked away from the man and laid on its back and the man had followed the dog to stroke him, misinterpreting the dog exposing it's underside as a sign of affection, not "walking away/lying on back " = leave me alone/submission under stress.
Dogs usually do give warning signs of what they are going to do but they can be very subtle and context is everything.
How is your dog generally when it comes to possessiveness? Does he guard food or his place on the bed, or sofa? Encouraging play biting is possibly not a good move.
But second bite more worrying. The context doesn't sound as if it was pain related but worth a vet check anyway. It sounds more behavioural. Is he generally frustrated on the lead? Do you ever walk him off leash? How is his recall generally?
In your shoes , once any pain has been ruled out, I think I would go back to basics, working on simply getting his attention and rewarding with a clicker and a treat using the "look at me" command.. Start at home in an enclosed area and then gradually move out to more open, more stimulating spaces. Then when you want to redirect his attention in future , keep the leash in a loose "smile" and instead of yanking or pulling , use the "look at me" command first. The brain has to engage before his body does ifyswim.