As is the case with animals that eat flesh or blood, mosquitoes must have a mechanism that they can use to find their food. Mosquitoes have developed a number of mechanisms that they can use to identify a human being, and get attracted to them. One of these is the carbon dioxide that you produce.
Whether you are sleeping or awake, you produce a small quantity of carbon dioxide through breathing and through the skin. The mosquitoes can identify the carbon dioxide from up to 35 meters away. They then track the source of the carbon dioxide by considering the side in which it is most dense, and where it is less dense.
Once the mosquito gets very close to you, other means of location take over. The human body produces more than 350 individual scents from the oils and other natural smells that the body produces. Some of these seem to attract mosquitoes, and make it easier for the mosquitoes to locate you from close by since these chemicals don’t diffuse very far.
This technically means that if you are to avoid being bitten by mosquitoes, it would be a good idea to make sure that these attractants are not there. However, as this is not yet possible, your best option would be to use sprays such as EcoRaider® to get rid of them. They tend to be environmentally friendly and extremely effective, meaning that you will not have a mosquito problem for a long time if you use it consistently.