The film starts, as usual, with Scrat (Chris Wedge) trying to find some place to store his acorn. Before he can stick it in the ice, he falls through some ice and into what first seems to be a cave. Scrat puts the acorn on a pad that turns on a giant flying saucer. He bursts it out of the ice block it was trapped in and out into space. After hitting the planets like pinball or pool balls, Scrat ends up shot out of the saucer with the acorn. He decides to stick it into an asteroid, naturally causing it to split and send it hurtling toward Earth.
Down on Earth, Manny (Ray Romano) and Peaches (Keke Palmer) are playing hockey with a turtle shell while Crash and Eddie (Seann William Scott and Josh Peck). They're joined by Peaches' fiance Julian (Adam Devine), a lovable mammoth. Ellie (Queen Latifah) and Granny (Wanda Sykes) come in. Julian gives Ellie flowers, which Manny is annoyed with, just like every other thing Julian does, even though everyone else loves him. Ellie then pulls Peaches away for something private.
Sid (John Leguizamo) is practicing a proposal for another sloth named Francine (Melissa Rauch). He thinks she's his true love, but they only went on one 14-minute date, and she can't stand him. Francine leaves Sid alone with a mariachi band that he prematurely set up. He wipes his tears with a poison ivy leaf.
Manny talks to Diego (Denis Leary) over Ellie having been acting weird. As for Diego, he and Shira (Jennifer Lopez) have contemplated having kids of their own, but kids seem to be terrified of them. This isn't helped after they eat some berries and have juice dripping down their fanged mouths as two kids walk by.
Manny finds Ellie and all their other animal friends having organized a party for their anniversary, which Manny totally forgot. Before that can become obvious, fireworks start going off in the sky, which everyone thinks is Manny's gift to her. During the party, Julian lets it slip that he and Peaches will be moving away from Manny and Ellie after getting married, even though they believed the two of them would live near them as neighbors. Moments later, a meteor comes falling toward them all. The animals run for cover as a full-blown meteor shower starts coming down. The herd runs into a cave and waits it out.
Underground, a family of Dromaeosaurs (or "dino-birds") - Gavin (Nick Offerman) and his two kids Gertie (Stephanie Beatriz) and Roger (Max Greenfield) - swipe an egg from a triceratops. Buck the weasel (Simon Pegg) swoops down and chases after the dino-birds, retrieving the egg and returning it to its mother. Buck then comes across an old stone pillar that prophecizes a doomsday event, which he takes with him to the surface. The dino-birds decide to follow him and kill him.
The herd looks outside the cave and sees everything nearly in total ruins. Buck crawls out of the hole from underground and reunites with his friends while meeting Shira, Granny, Julian, and a grown-up Peaches. Buck pulls out the pillar and explains that every few thousands of years, Earth gets cleansed by a gigantic meteor that crashes in the exact same spot, so if they can head to the crash site, they can perhaps figure out a way to stop this meteor from hitting. As they head out, the dino-birds hear their plan, and Gavin thinks they can avoid it since they can fly and avoid the crash, but Roger calls him out on that being a bad idea, so Gavin berates him like always.
On their way, the herd picks up some rocks that happen to be magnetized. Since Crash and Eddie are confused (or just way too dumb to understand), Buck brings them inside his mind to meet Neil deBuck Weasel (Neil deGrasse Tyson), along with Pythagorus Buck and Robo-Buck to explain the magnetic attraction of the rocks. The herd figures that if they get enough of these rocks, they can propel the meteor away from Earth.
As Scrat continues to get his nut, he uses the ship to cause some trouble on Earth. He pulls the moon around the planet to cause water to rise, which works to let the herd pass through. Then he hits another planet and causes an electric storm. The animals protect each other from the threat.
Manny and Ellie try to get in the way of Peaches and Julian's plan to move away. Manny first plays hockey with Julian, but since the guy isn't very coordinated, Manny accidentally whacks him in the face with the puck and causes him to fall into the icy water (he's okay, though). Later, Ellie (with help from Sid, Diego, Crash and Eddie) sets Peaches up with some problems she and Julian could face as parents. Peaches quickly takes care of everything like a champ.
The herd rests for the night. The dino-birds stalk them and send Roger to get Buck. He flies into the cave, but he ends up taking Granny instead. She isn't afraid of the dino-birds, even when Gavin swallows her whole. When she threatens to pop out of you-know-where, Gertie helps her dad cough up Granny.
In the morning, the herd notices Granny is missing. They hear her yelling and see that the noise is coming from a crashed asteroid that is filled with thousands of magnetic crystals. They find Granny getting a massage from a bunny named Teddy (Michael Strahan). The herd is found by a pretty sloth named Brooke (Jessie J), who (for a reason nobody else seems to understand) instantly falls for Sid, and he reciprocates. Brooke explains that they are in Geotopia, and she brings the herd to the all-knowing Shangri-Llama (Jesse Tyler Ferguson). He makes the herd do some yoga exercises as Buck tries to ask him for help in launching the asteroid up in the air to stop the incoming meteor. Shangri-Llama refuses since the asteroid is what has kept him, Brooke, and the other animals living in the asteroid young and attractive.
Brooke asks Sid to be her life mate, which he accepts. He wants to give her a nice crystal as a gift, so he picks one out of the wall, which causes the whole asteroid to fall apart and make the animals look like their proper ages, including Brooke. Shangri-Llama angrily chastises Sid. However, when it becomes clear the danger they are in (thanks to Scrat AGAIN), Brooke rallies the other animals to help the herd plug up the geysers so they can throw the crystals into an active volcano to shoot them at the meteor. As they set the plan in motion, the dino-birds swoop in and try to kill Buck, but he appeals to Roger and helps him convince Gavin and Gertie to help out so that they can all survive. The dino-birds help pull the biggest crystal toward the volcano, but it is too heavy to push in. Manny tries to do it with Julian, but Julian suggests they let it roll down the hill so that it can eventually roll into the volcano. The plan works, but the crystals don't shoot up until Granny plugs up the last geyser. The meteor then flies off-course and back into space. The animals celebrate.
Sid and Brooke say goodbye to each other, giving each other drawings to remember one another. Granny also decides to stay so she can be with Teddy. After Sid leaves, the Geotopians get into a hot tub, where a crystal falls in. This makes everyone young and pretty again, including Granny and Brooke.
The rest of the herd gathers for Peaches and Julian's wedding. Manny and Ellie finally accept that their girl will be starting her own family soon. Diego and Shira then tell the same kids they scared earlier the story of how they helped save the world. Brooke arrives at the wedding and reunites with Sid, then sings a song for the party.
Neil deBuck Weasel then takes us to Mars to show that it was once a hospitable planet. This changes when Scrat shows up and dries the place out, making it uninhabitable. He gets back in his ship and flees.