A sneeze, or sternutation, is a semi-autonomous, convulsive expulsion of air from the lungs through the nose and mouth, usually caused by foreign particles irritating the nasal mucosa. A sneeze expels air forcibly from the mouth and nose in an explosive, spasmodic involuntary action resulting chiefly from irritation of the nasal mucous membrane. Sneezing is possibly linked to sudden exposure to bright light, sudden change (fall) in temperature, breeze of cold air, a particularly full stomach, or viral infection, and can lead to the spread of disease.

The function of sneezing is to expel mucus containing foreign particles or irritants and cleanse the nasal cavity. During a sneeze, the soft palate and palatine uvula depress while the back of the tongue elevates to partially close the passage to the mouth so that air ejected from the lungs may be expelled through the nose. Because the closing of the mouth is partial, a considerable amount of this air is usually also expelled from the mouth. The force and extent of the expulsion of the air through the nose varies.

Sneezing cannot occur during sleep due to REM atonia – a bodily state wherein motor neurons are not stimulated and reflex signals are not relayed to the brain. Sufficient external stimulants, however, may cause a person to wake from their sleep for the purpose of sneezing, although any sneezing occurring afterwards would take place with a partially awake status at minimum.

More Info: en.wikipedia.org