If you want to keep your pesto in the fridge, just keep it in a bowl or jar but do cover it with a slick of olive oil to stop any exposure to the air. This will stay fresh for days or even all week.
However, the best thing to do is freeze it in ice cube trays and have to hand whenever you might need it.