In Soleanna, the Festival of the Sun's opening ceremony is disrupted by the arrival of Doctor Eggman who seeks the Flames of Disaster from Princess Elise, as well as the Chaos Emerald she possesses. However, Sonic the Hedgehog arrives and escapes with Elise and the emerald intact, but Elise is quickly captured but she tosses the emerald to Sonic. Sonic meets with Miles "Tails" Prower and they rescue Elise, Tails distracting Eggman's robots whilst Sonic and Elise escape. Meanwhile, Shadow and Rouge the Bat meet up armed with the Scepter of Darkness stolen from Eggman's base, but it is dropped, unleashing Mephiles the Dark, a shadow-based creature who reveals Shadow sealed him within the scepter ten years ago, before opening a wormhole which transports Shadow and Rouge to the future. Silver and his friend Blaze the Cat live in a post-apocalyptic world caused by the Iblis Trigger, who unleashed the Flames of Disaster, actually a fiery monster named Iblis. The two meet Mephiles who reveals Sonic is the Iblis Trigger, and sends the two back in time using a fake Chaos Emerald.
Silver and Blaze are separated upon arrival, Silver witnessing Eggman's attack on Soleanna and Sonic's departure. He meets Amy Rose who accompanies him to find Sonic, but defends Sonic when they find him, Elise getting kidnapped again. Sonic flees, meeting with Tails and Knuckles the Echidna who go to rescue Elise. However, they are lured into a trap by Eggman and warped into the future where Tails discovers Elise and Eggman died the day before Iblis was released. Shadow and Rouge find a shutdown E-123 Omega, and then reunite with Sonic, Tails and Knuckles. They gather several of the Chaos Emeralds, and return to the present save Shadow who confronts Mephiles, but learns in the future he was imprisoned by Omega, blamed for the destruction. Shadow escapes to the present-day thanks to Omega.
As the story progresses, Shadow and Silver join forces and travel ten years into the past. They learn Iblis and Mephiles are the result of the Duke of Soleanna's project to harness the power of the city's god Solaris. The Duke gives Shadow the Scepter of Darkness, which he uses to seal Mephiles, whilst Iblis' flames are contained by Silver and placed within a young Elise's tears, the dying Duke asking his daughter to never cry for her tears could release Iblis. Sonic fails to rescue Elise from dying, but Silver suggests going back in time to prevent her death. Sonic succeeds, saving Eggman from dying too. Shadow, Rouge, Omega, Silver and Blaze return to the future to eliminate Mephiles and Iblis. Mephiles is defeated by Shadow, whilst Silver tries to seal Iblis' flames in his own soul, only to be rejected. Blaze steps in and seals Iblis in her soul, but is trapped in another dimension.
Mephiles survives Shadow's attack, and kills Sonic by running him through with a crystal blade, causing Elise to cry and unleash Iblis. Mephiles bonds with Iblis, recreating Solaris and ripping apart the time-space continuum. Tails, Knuckles, Amy, Shadow, Silver, Rouge, Omega, Eggman, Elise and Sonic's corpse are brought together. However, Elise guesses the Chaos Emeralds can resurrect Sonic, prompting everyone to locate the emeralds. Elise uses the emeralds to resurrect Sonic as Super Sonic, Shadow and Silver transforming into their super forms and destroy Solaris. Sonic and Elise go back in time, finding Solaris' original form to be a single white flame. Elise blows out the candle, rebooting the time-space continuum and erasing Solaris from existence, erasing the story's events. Sonic passes by the Festival of the Sun, he and Elise showing signs of recalling their friendship.