Not long after Megatron's demise and the restoration of Cybertron, the Autobots celebrate as Optimus Prime [Peter Cullen] knights Bumblebee [Will Friedle] as a warrior. Optimus Prime [Peter Cullen] and Wheeljack [James Horan] embark on a quest to find the AllSpark, the source of Cybertronian life, while the rest of the Autobots pursue the missing Decepticons Shockwave [David Sobolov] and Starscream [Steve Blum]. Meanwhile, at the bottom of the Pacific Ocean, Megatron [Frank Welker] is revived and possessed by Unicron [John Noble], intent on destroying Cybertron.
As Bumblebee's team searches for Shockwave and Starscream, Ultra Magnus [Michael Ironside] and Smokescreen [Nolan North] are attacked by their Predacon creations Skylynx [Nolan North] and Darksteel [Steve Blum], forcing Ratchet [Jeffrey Combs] to return to Cybertron to tend to the critically wounded Magnus.
Bumblebee [Will Friedle], Smokescreen [Nolan North], Bulkhead [Kevin Michael Richardson], and Arcee [Sumalee Montano] track down Predaking [Peter Mensah] in an attempt to recruit the new Predacons, but Predaking refuses to help. After Bumblebee's team heads to Megatron's old fortress in Kaon on the imprisoned Knock Out's [Daran Norris] suggestion, they are confronted by Unicron [John Noble] and are forced to escape.
Meanwhile, in the Theta Scorpii asteroid belt, Optimus Prime [Peter Cullen] and Wheeljack [James Horan] locate the AllSpark's container, which Optimus retrieves as they begin their return trip to Cybertron. With Ultra Magnus wounded in action and Optimus unable to communicate with them, Bumblebee assumes temporary leadership of the Autobots.
Predaking begins searching for Skylynx and Darksteel, but finds Unicron instead. After easily defeating him, Unicron encounters Shockwave, Starscream, Darksteel, and Skylynx harvesting bones from a massive Predacon graveyard. Unicron overpowers Skylynx and Darksteel and resurrects the ancient corpses into undead Terrorcons; Starscream flees while Shockwave is injured by the Terrorcons. As the undead horde heads for the Well of All Sparks, the Autobots prepare to fight back while Ratchet stays behind with Ultra Magnus. Starscream sneaks on board the Nemesis and frees Knock Out and the captive Vehicon troops but Knock Out defects and incapacitates Starscream before he can commandeer the ship and flee Cybertron.
Predaking finds Skylynx and Darksteel at the Predacon graveyard, and the resulting brawl is interrupted by a wounded Shockwave, who suggests that they assist the Autobots. Unicron's undead army is confronted by the Nemesis and the Predacons at the Well of AllSpark, but the ship is shot down as Starscream escapes.
Optimus and Wheeljack return, but Unicron shoots down Wheeljack's ship, defeats Optimus, and seemingly claims the AllSpark. However, his Anti-Spark is pulled into the empty container, sealing it away forever. The Terrorcons disintegrate and Megatron [Frank Welker] is freed. Having a change of heart, Megatron [Frank Welker] disbands the Decepticons and flies off to start a new life. Starscream flies back to Darkmount to take command of the Decepticons only to be confronted by the Predacons.
Optimus reveals that he emptied the AllSpark into the Matrix of Leadership within him but can no longer be separated from either and must sacrifice himself to restore life to Cybertron. The Autobots try to dissuade him, but Optimus states that the Matrix cannot be restored again and asks that they continue to protect Cybertron. As the others vow to keep the peace, Optimus [Peter Cullen] plunges into the planet's core, causing millions of sparks from deceased and unborn Transformers to emerge from the Well. The Autobots watch as Optimus's spark joins the multitude among the Well, while he narrates that his sacrifice marks a new beginning rather than the end.