Thank you. The symptoms of anal glands sound about right. Thank you for the help. I'll try some methods suggested to express him. If it doesn't help, I'll take him in.
It figures that if it is more uncomfortable towards the end of his bowel movement rather than at the start, he is using more muscular effort as the feces will be smaller then. At the beginning of his bowel movement, there is more natural pressure so a little less effort, if you see what I mean?
It does sound a bit like he is feeling the pain from his rear, rather than from his abdomen, as you said he turns to look at his back end. If it was from his abdomen, he would probably 'hunch' his back and put his tail between his legs instead.
But listen....I can't see your dog, and even if I could I am not a vet. And I couldn't diagnose from a distance. The safest way would be to take him to the vet to be checked professionally. Yelping, for a dog, means pain.
But here are one or two things you could try:
Lay him on his back, and make sure he is relaxed. Then gently and firmly, feel into his belly. If he winces or yelps when you do this it means something hurts inside.
Examine his anal area. Do you see anything there? Any swelling, or redness? Anything which might signify anal gland swelling/abscess, etc.
Expression of the anal glands is pretty routine, and the vet will not charge much for this (if it IS an anal gland problem) Or you could try doing it yourself, to see if that makes a difference.
I have never had to do this! My dog doesn't get anal gland problems at all, so I have no experience, but if you put "anal glands" into the search box in the Archives here, I seem to remember there were quite a few posts a little while ago by people who know how to do this properly.
Thank you for the tip. He is not neutered. So that could be the problem. We don't give him bones but he could have gotten somewhere. What I thought unusual was that it happens when his bowel is just about empty not when it's full. The pain must come rather sudden. He acts as if someone hit him. In fact he keeps looking where he was having the bowel movement. Is it something I can wait before taking him to the vet? To see it goes away on its own? A couple of months ago he had a major surgery which cost a lot.
BTW....My dog seems to crave grass when she senses she needs extra fibre. It doesn't make her vomit, as some dogs do after eating grass, but it does make her bowel movements slightly looser. Not dramatically so, but similar to what you described with your dog. This extra fibre also does make the bowel-sounds more noticeable....
Yelping means it hurts. It must hurt quite hard for him to yelp. Dogs don't usually yelp unless something REALLY hurts. Maybe you should take him in for a (very unenviable!) rectal exam? And you could mention that you think he has an upset tummy generally.
Has he been neutered? If not there is the possibility his Prostate gland could be slightly swollen. Also (whether he's been neutered or not this could apply) -if he has an anal gland obstruction of any kind, or simply needs his anal glands expressing, this could cause irritation and possibly pain.
Has he eaten or swallowed anything which was sharp, like bone?
Rice diet is good for an upset tummy. A little boiled white fish (de-boned) could be added quite safely to this for extra protein and to keep his strength up.