If he likes to do that, it is possible that he has introduced a bit of dirt or grit that has gotten under the foreskin and is irritating it or it could be a UTI. Try to get him to drink as much as possible overnight and bathe it in saline with nappy changes and in the morning get something from the chemist or they may just recommend that you take him to the Dr. If he is in pain, give him some panadol as well