Although not as common in boys as in girls, urinary tract infections can cause this. It also causes you to urinate more frequently (therefore the accidents), because you constantly have the urge to pee, even when there is nohing left anymore. And it really hurts.

Hope he is better soon.