The first thing that comes to mind is abuse the smash attack's Super Armour. Although, since Sonic players will have to respect the Armour, so they (most likely) won't be trying to rack up damage by getting in your face. USmash or an upward FSmash can easily punish homing attacks pretty easily... although it can be risky in case that they happen to end up behind you and you miss the Smash attack, So they CAN still punish back in that scenario. Don't be counter happy (kind of obvious), cause most Sonic players will abuse their grab range to punish. Speaking of counter, am I the only one that has an easier time connecting counters on a fully charged Spin charges and Spin Dashes, rather than the uncharged ones?
Whenever Sonic approaches with any spin dash (Down or side B) just hold Jab, since it can beat it out free,
except against a fully charaged one... don't bother against those

Although for this MU, most Sonic's will mostly use it as a way to mind game with you rather than as a damage tool. Watch out for the B-throw when you are close to the edge. It can't KO as easily as Ness' can, but its certainly up there in terms of how good it is. Also watch out for Up throw, at higher percents any decent sonic player will take the opportunity to do the up air follow-up and KO you at the ceiling.
If you somehow manage to land a grab, use that opportunity to either DThrow/ UThrow with an Up B follow up. It gets me a fair amount of kills and can kill about 100%+, depending on the stage ceiling (mind you though, I still need to test it more though) and can rack up damage pretty quickly as well..
Sonic's will usually approach from the air, since most ground options are a no-go zone for them, so watch out in case they tend to mix some things up like doing a spin-dash into a jump, Double jumping in different directions or homing attacks. Also when recovering, Spring gimps can destroy Mac is used right.
Really though, during this entire match up, Sonic players WILL keep you guessing about what they will do and can easily bait and Punish Smash attacks pretty easily, especially things like USmash (which has slightly more cool down more than his other Smash attacks) with Grabs. Although, it is possible to mash out Mac's jab if you see sonic going in for the punish.... it actually works rather well, depending on the situation. Also don't get grabbed

lol. But really though, this matchup is either a 65-45 or 70-30 Sonic's way.