My best guess is that Sonic pulled off something like Superman does and simply circled the world at incredible speed to tear open a path home.
Super speed has always been Sonic's signature trick for bending reality and crossing between worlds, so racing around fast enough to break through fits his style perfectly. The games do not always spell out every detail, which leaves a little room for interpretation.