Does he have a bladder problem? Did something new just happen in his life? Is he having trouble with other kids at school? If it's a regular thing, maybe you should take him to the doctor... maybe his bladder hasn't matured yet.
my 6 year old is having the same problem and at first we thought it was because of the new baby coming home and he was just doing it for attention but it has continued on for too long so we took him to a urologist and they said that his bladder was not matured like it should be(he was a preemie at birth)so they have started him on some meds to see if that helps and we have to go back in a month and see what they say. MAybe you should talk to your doctor about this and see what they suggest they may send you to a specialist. Good luck.