Here is the reason: since viruses enter your nose 24/7, your body needs to minimize the number of viruses and bacteria that enter your body when you sleep, which lowers the speed in which your pulse and your blood cells are less active and can't fight so many viruses, which results in your right nostril, contracting to close itself when you sleep.