If nobody minds, I'd like to throw my two cents out there on what I've found success in against the few Sonics I've come across in the Northwest.
Sonic can be an odd matchup at best, and a frustrating one at its worst. With a strong pressure game, and solid movement, he can effectively move into Link's range and be gone before Link can do anything in time. Even Link's fastest options may not prove to be fast enough in most situations, but as per usual, N-air is going to be your best friend when it comes to quickly shutting down aggressive approaching options. Jabs can pop him out of Side-B while allowing for quick follow-ups, but the timing could prove to be difficult if you don't have consistent experience against Sonic.
N-air out-of-shield is an excellent option to relieve pressure and reposition (that is, when uB OoS would be too weak to kill Sonic), but be wary of staying in your shield for too long. Sonic's attacks allow him to shield poke very easily (being that his whole body becomes a hitbox, and a mobile one at that), as well as letting him move out of your range and remain a threat.
Sonic's movement is going to be your main problem in this matchup. Your disjoint can beat out his attacks, it's just a matter of having him consistently in a position to attack. Anything you can do in this matchup to hinder his movement is going to go a long way towards your success. Platforms can generally cover you from Side-B abuse, so good stage picks include Yoshi's Island (Brawl), Battlefield, or Wario Ware. Avoid anything that you'd avoid taking Puff to, which means high ceilings and long walls, and anything that can aid him in survival. Despite some opinions out there on him, Sonic boasts some strong survivability options when a player who knows good DI choices is playing him.
Along with your stage pick, your personal use of tactics will lead to success or catastrophic failure against this character. In my own experience, I've tried to avoid anything that gives up my own position and leaves me open for too long (longer than would be acceptable against most other characters). Dash attack, the DACUS, F-Air, Bow, and the like. I also try and avoid attacks that only hit a specific area on the screen, like Z-Air, B-Air, and even 'rang under most circumstances. I instead stick to attacks that encompass a large area that Sonic is bound to literally run into. N-air is a good way to move around safely, and D-air is an excellent way to punish any sort of homing attack approaches or aerial followups from below if they become predictable.
Bombs are a godsend in this matchup. Lay them out along the ground, and do it as often as you can. Trust me on this. Sonic does have the options to get around them, but an inexperienced or panicky Sonic can be taken advantage of when their movement options are limited. Boomerang can control space in some respects as usual, but I personally try not to be over-reliant on it in this matchup. Sonic makes the recovery off of throwing one feel like an eternity, and the less openings you leave for yourself, the better. Having bombs scattered about on the floor and platforms above you also make for handy projectiles to be thrown at any time.
Like I mentioned before, a good Sonic can live to some pretty ridiculous percentages, but all hope isn't lost. Though Sonic can escape any sort of pressure from below rather easily with spring escapes, the move as a recovery option is extremely linear, and pretty punishable. This is a matchup where a Sonic below the stage can be easily offed with a Hail Mary D-Air from above. It's something that's never expected (who expects Link to dive offstage with one of his slowest attacks?), is practically a guaranteed hit, and is absolutely brutal in terms of killing potential. A Sonic player hugging the wall of the stage is a perfect candidate for this attack, so try and find yourself in those situations where Sonic is below and near the stage.
Most of the usual in terms of dealing with pressure still applies here. uB OoS and Nair OoS to deal with and escape pressure, bombs to limit stage control, and... well, that's it, really. Sonic's a matchup that I personally struggle with a lot, but those are the sort of things that I keep in mind when I have to play against a decent one.
Any advice on the Sonic matchup that any of you would like to pitch in? Correct me on anything that you've tried and found no success with. This is by no means a "do this and you'll win against Sonic" post, these are all just things I've found success with.