Ohhhkay Sonic, been holding out a bit on my thoughts here but I do have some (not as much as I'd like to have though).
Lemme just get this out of the way first. This matchup is BAD. Like seriously, bad, probably our worst.
So let's start with the neutral. This is the worst or second worst part of the matchup here. You can NOT just go throwing out aerials defensively. I don't care what it is, or how safe you think it is, Sonic in his optimal range can ALWAYS punish it, yes that includes fade back SH fair. There's a particularly big part here I want to discuss that I call Sonic's "zone." When Sonic is about half an FD away from you, this is his zone. This is the perfect stick and move location for him where he can hover just outside of your range, but move quickly in to punish any attack you throw out. You do NOT want to let him in this zone. You either want him very far away, to the point where not even his speed can punish your moves, or be right up in his face (preferrably this one, since this is advantageous for Ness).
Needless to say, don't use PKF in this matchup. You can get punished for this just about anywhere.
Now while Sonic IS in his zone, you MUST know his movement options and spin dash tricks. Please please PLEASE do yourself a favor and sit in training mode as Sonic for a few minutes and get a grasp of his options out of his side B spin dash. Upon starting the spin dash, Sonic backs up. During this time, he can shield and jump cancel it. These are primary fake outs that you MUST know exist. Refrain from throwing out any instinctive moves when dealing with these fake outs. Sonic players always sit in his zone, and toss these babies out, waiting for you to make a move, then they capitalize on it. After that initial "rollback," Sonic loses access to the shield fake. At this point, he must commit to actually rolling in your direction, or use the jump cancel (which isn't nearly as threatening IMO).
During the actual attack of the spin dash, Sonic can jump and turn around. Turning around has no hitbox temporarily, while jumping adds another hitbox and allows him to do an aerial follow up. This is the Sonic BnB, and the reason why getting hit by spin dash is so dangerous. That's 3 hitboxes mind you, so when you see that ball of death coming in, shield or dodge potentially 3 hits. Sonic cannot grab during spin dash, but if he hits your shield, he'll probably just jump away anyways.
I cannot emphasize enough how important it is to know spin dash mechanics. Familiarize yourself with them, and try to not ever fall victim to his fake outs when Sonic is in his zone. Falling for these attacks and throwing out whiffed attacks is EXACTLY what Sonic players want us to do. You must be very pinpoint and deliberate with your hits here.
Now let's say you get Sonic out of his zone. You're right up in his face, he can't abuse spin dash tricks or weave in and out of your range. This is actually where the matchup gets good. Sonic' up close game really isn't spectacular. His priority is average, and at this range your combo damage is much better. Basically, once you're in his face, make the most of it, and try not to let him get away from you again.
When it comes to comboing Sonic, PKF is mediocre. His quick UpB can get him out of it. PKT juggles I feel are tough on him too because of his UpB with his dive kick combined. His UpB also drops a hitbox downwards, so it might just eat your thunder. Sonic just has so many ways of changing his aerial momentum, and if you miss with thunder, you're probably gonna get punished because he's so fast. I'd stick with mostly grabs and aerials for damage.
For aerials, Ness actually wins this by a long shot. Unless you've been set up by a spin dash jump, you should win most aerial encounters. Fair can pretty much do this alone. Not much else to say here. You wanna take him to the air. If he's up there, he's not dominating the ground.
Now for the KO phase. Sonic had a huge buff to his KO ability in this game, with fsmash gaining range, and usmash and bthrow gaining KO power. I still think Ness has better KO moves, but Sonic has an easier time landing them. It is INCREDIBLY hard for Ness to land a grab in this matchup, I'd say more difficult than any other character in this game (and that's one of the reasons this matchup sucks so much). Sure, Ness will KO him sooner, but Sonic will have many more opportunities here. Be wary of Sonic's dash grab and dashing into usmash. You should rarely get hit by uthrow into uair, just air dodge that, and NEVER let him have that opportunity. It may be an even aspect of the matchup overall.
Off stage is a nightmare. I'd say Sonic is one of the more potent edgeguarders of Ness, right up there with Sheik and Rosy. Respect the spring gimp. You don't want to get hit with it during any part of PKT2, even the invincible part. The spring will cut the distance of PKT2 in half even if you don't get hurt by it. If you do, it semi spikes, which is never good. On top of that, Sonic can go VERY deep with his edgeguards if he feels like it (though it seems like few Sonic players go for this strategy) because of his large recovery. Gimping Sonic is also no easy task. He's got multiple recovery options in the form of spin dashes, homing attacks, and that amazing spring recovery. PKT edgeguards are okay here, not great IMO. Definitely a bad part of the matchup here. Never get caught off stage, and try to be as safe and accurate with your own edgeguards as possible.
I think that covers basically everything I have to say here. So quick tips:
1. Know how spin dash works
2. Don't fall for spin dash fakes
3. Get him in the air
4. Don't be off stage
5. Very limited use of PKF
6. Get in close
7. Don't get uthrow -> uaired
8. Don't abuse fair. I know it feels safe in a lot of matchups but it really isn't here.
9. A little extra one, try to spot dodge homing attack if you see it coming. The lag when he hits the ground is huge.
Final notes, I don't think it's safe to say a "punish game" is what's most effective on Sonic. Sonic has a bunch of nigh unpunishable **** in his aresenal. What I really feel like you should be doing is a strong prediction game, anticipating his movements and getting in when you can.
The matchup overall is -2 straight for me. No more, no less.