I guess you could punch holes in the lid and put the lid on while he is inside for his bath. But it sounds like he has a ball kicking all the sand out! Seems like a great hamster game!
Why don't you just put his jar in a bin that catches all the sand and then just pour it back in the jar when he is done?
Incidently, when he is rolling around on his back in the jar, he is putting his scent all over it and is claiming it as his own. He must really love it!