Prevents the passage of food particle to small intestine (duodenum) until proper mixture with gastric juice. Prevents backflow from intestine to stomach.
The stomach wall has three layers of smooth muscles. The outer layer is longitudinal, the middle layer is circular and the inner layer is oblique. At pylorus, the middle circular layer is greatly thickened (50 to 100 percent greater than in earlier portion) to form pyloric sphincter.
The sphincter remains slightly tonically contracted almost all the time. But it is usually open enough for water and other fluid to pass from stomach to intestine.
The constriction of sphincter prevents the foods to empty into intestine until foods are mixed well with gastric juice (containing HCl and enzymes). This mixing results in chyme, which has almost fluid consistency.
Pyloric sphincter also prevents backflow of chyme from intestine (duodenum) to stomach.
Anatomy of stomach, see the position of pyloric sphincter :