There are so many possible causes for this. Our five year old started this when he was 4.5 yrs old, and suddenly. I don't know what to do either, except to remind him to get up from his activity and pee when I notice he hasn't for a while. Otherwise we just provide him with what he needs to clean himself up and dress and then he re-joins us and continues his activity. I've never punished for this; he is always so embarrassed and upset about it that he oftentimes won't tell us and we just notice he's wet.
I've read that this is common around these ages especially for boys, and I've also read that there can be brain involvement and that it is more common with Inattentive ADD (which he has).
We gave him Hyland's bedwetting homoeopathic preparation at bedtime and he's woken up to pee each night instead of peeing in his bed. I forgot last night and he peed in his sleep.
I'm going the 'be patient' route and hoping it'll resolve with or without my help (because I'm always willing to help if I can).