Well the tail is made from bone, tendons and muscle and can get broken, sprained, etc. If your dog has been swimming in cold water or swimming a lot there is a condition called Limber Tail Syndrome (aka Broken Wag) and it is sort of like a sprain. Labs are notorious for getting this. Anyway, if it is hurting him you should probably take him to the vet to see what is going on.
Your dog can avoid wagging its tail in case of a bite, which can cause it pain. It could also be that the dog was involved in a vigorous exercise or activity, thus overworking the muscle that run the tail, resulting in pain. It would be good that you consult a vet to check on your dog. Check out http://vetmedicine.about.com/od/diseasesconditionsfaqs/f/_limptail.htm.
He needs to see a vet .. there is no other way to determine what the problem is. Dogs also have a gland slightly inside their anus that can become plugged, and can cause intense discomfort and pain. He needs to be examined.
I have a pitty mix pup and at one point he had diarrhea and his but was sensitive, apparently he had worms. That was when we first got him. Or he could have injured his tail, gotten it stuck or something. It's probably be best to take him to a vet soon. Does his tail look like it could be broken?