The National Center for Home Preservation's guideline is three days when refrigerated. I suggest cutting a circle of parchment to fit inside the jar or container; place it directly on the surface of the pesto. This will prevent the top layer of pesto from oxidizing and discoloring.