I'm going to say S3&K, but by the tiniest of margins.
Second is Sonic Rush Adventure... but in actual fact, you might as well say its joint first, since I like both for different reasons.
S3&K was just a very well constructed game... level design, routes, all that. Rush 2 is good for the entirely different reasons of insane speed and tricking. People complain about Rush 2s stupid 'Adventure' aspects, but really you do that once and then just play time trials.
I loved the whole speed and trick idea since Sonic Advance 2. They screwed it up for Advance 3 but then when things moved on to DS, Rush was awesome and Rush 2 polished the stages even further at the cost of having to suffer some annoying map and minigame stuff (and somewhat worse music).