Oooooh, I can see why you're upset!
Since he is 5 and should be verbal enough to express himself I would sit down and talk to him calmly about his behavior. (Honestly, when he urinated in the trash can more than once I would have sat him down for a talk.) Tell him that you and daddy are very upset by what he's been doing, and let him know he will be apologizing to the parents of your niece.
Since you really need to know ask him why he's doing it. You say he has no explanation, but there has to be a reason. He may be only 5, but he needs to learn that he's accountable for his actions. If he insists he doesn't have a reason let him know he can go to his room and lay in bed (no playing with toys) until he can tell you. He obviously knows he's to use the toilet, so I'd be real curious as to why he now thinks it's OK to go in random places.
Regardless of his reasoning tell him that he is NOT to do this ever again, and that if he does he will have a consequence, say, going to his room alone and bed early, (if it happens towards evening,) no TV/video games the rest of the day, (if it happens in the morning or afternoon,) or whatever consequence you feel will make the biggest impression on him.
Hope this helps!