Pesto turns brown when stored because it is exposed to air but this can be prevented by adding some extra olive oil over the top or placing plastic wrap directly on the top of the pesto. Homemade pesto should be used within 3-5 days and is recommended that you store leftover pesto and pasta separately.