Diaphragm is a muscular membrane present below the lungs.
The diaphragm moves up and down, and thus in this way increases or decreases the volume of lungs. 

When the volume of lungs is more, pressure inside decreases. So, the oxygen rich air in the atmosphere, which is at higher pressure, comes into the lungs. Similarly, when the volume of lungs is less, pressure inside increases. So, air containing carbon dioxide is pushed out of the lungs.

In this way, movement of diaphragm controls breathing.

At the upper side of trachea (wind pipe), there is the glottis. Glottis is covered with a cartilaginous flap of skin known as Epiglottis. When we swallow water or food, the trachea gets covered by epiglottis, thus preventing the entry of food or water into lungs.

Thus, Epiglottis prevents entry of food or water into the trachea and hence the lungs.

1 4 1