1. You might not know/understand the matchup
2. You're not dealing with the whole "Sonic spinning-rolling-dashing-jumping-attacking" thing the right way
3. Sonic's speed might make lasers less effective than you're used to
I had these problems for awhile, but they get a lot easier with knowledge and practice. Knowledge is huge here. Knowing WHEN sonic's attacks hit you and HOW they hit you is beyond important in this matchup because a lot of his attacks might look similar, especially when he's rolling. You also need to know which moves clank or beat out which of Sonic's moves, or how to deal with ones that don't.
For example, ROB's jab clanks with a lot of sonic's "spindashing" (ASC) techniques, but you need to follow up with something afterwards, otherwise he'll just hit you again. If you're just learning the matchup, try shielding a lot, NOT spot-dodging. This alone stops a lot of sonic's approaches, many of which involve spinning into you, cancelling it with an attack or jump, and getting out of the way. Just watch out for being grabbed.
Sonic's faster than you. Duh. He has no projectiles like you do. Like Metaknight, these two things mean that he has no reason not to approach you, so expect him to. Sonic has a pretty bad air game compared to ROB. ROB's fair beats sonic in the air for the most part, but you NEED to always watch out for gimps. If you're high above sonic, always be ready for a spring>upair or other gimps. Sonic's three kill moves are F-smash (watch out for the range, it's surprisingly decent), D-smash (at higher percents), and Bair. Even though he looks light, he's actually around the "middle" of the weight classes. DI his throws as necessary, especially his up throw so you don't get spring-gimped.
Sonic has a lot of tricks up his sleeve when it comes to recovering. He can use a second jump, an up-B, and a spinning wall "jump" to get back on the stage. If you happen to grab him OUT of his up-b (unlikely, but I've done it a few times), he (like snake) can't use it again if you just hold him until the grab releases. A lot of Sonics will "test" you by using the homing attack, the standard B button. This is the annoying thing that you see about a billion Sonics doing for two minutes straight on WiFi every match. You know, the charge-charge-charge....SNAP right at you. Right when the SNAP part is about to happen, if you're in ANY type of invincibility frames (airdodge, spot-dodge, ledge invincibility frames), sonic will find himself hurtling straight down to the bottom of the stage. After you demonstrate that you can do this once or twice, you'll probably never see it again.
All in all, just watch out for his speed and his spinning attacks. Your projectiles aren't terrible here by any means, but they might not add on as much damage as they would against other matchups. Try to become familiar with all of Sonic's tricks (spring-dair autocancels ALL landing lag) and you'll find that the matchup becomes a lot easier.
Edit: Wow, I wrote much more than I thought I did.