The first thing to check is the water drain. It's located on both side corner on the front. The tube runs down on the A pillar and out the firewall. See if you could get water through the tubes to verify that it's draining. If it clogged, you can use a compressed air to clear the tube in most cases, if not you may have to remove the tube and clean it off the vehicle.. Another check you can do is to verify that the rubber seal around the glass is evenly distributed around the roof lip where is suppose to provide seal. A good test is to use a playing card and run it slowly around the seal area with the sunroof fully closed.If there is any sections that feels loose, the seal would need to be replaced. You can get the seal from a dealer. The card test is done on top of the roof FYI..