Sapropterin functions by acting as a cofactor for the enzyme phenylalanine hydroxylase. This enzyme is responsible for converting phenylalanine into tyrosine, another amino acid that is less harmful at high levels. By increasing the activity of PAH, sapropterin helps to lower the levels of phenylalanine in the blood, thereby reducing the risk of neurotoxicity and other complications associated with PKU.