Each time you feed your pet, you will increase the progress of the current level. Depending on the level you are in, you will have to feed it a certain number of times to advance to the next level.
You can find your pet's progress to the right of the bar that indicates its mood. There, you will see a counter that will tell you how many cookies it takes for your pet to advance to a new level.
By leveling up, in addition to increasing the amount of cookies needed to feed your pet, you will also receive a higher Ranking score when you feed it.