The older episodes are better. These episodes have good comedy, they teach values, and are just plain classics. These episodes (and some newer ones) are the reason why I put this as age 4 and up.
After the Spongebob Squarepants Movie Hillenburg retired and new writers (some were animators before) stepped in. This is where it got bad. Sure, season 4 was good and retained some of the classical parts, but after season 5 it started showing gross out gags, got boring, became cliche, etc. Some episodes were good, like the Special Pest of the West, and then it hit rock bottom in season 6 with One Coarse Meal. Now, I understand Spongebob by this time became a cash cow for Nick, and so they'd start to get stressed and make inferior episodes, but still...
After season 7&8 came the show got somewhat better, especially so when Hillenburg came back around season 9-11.
The problem with a lot of the season 5-7 episodes (and some later) was flanderization. They thought if we'd exaggerate a certain characteristic of each character, kids would like it. However they did it far too much and made Patrick a sociopath, Mr Krabs a greedy antisocial person, Spongebob too childlike, Squidward a man about to snap, Sandy into someone who doesn't exist, etc. Some good episodes were around, Sandcastles in the Sand was a great episode, Walking the Plankton and New Leaf was good, etc.