The story continues from the events of the second film. The penguins plan to never come back to africa to pick Alex and the others up. Alex has a nightmare about himself and his friends still stranded in Africa and finding they have all gotten old, and him as well. Awaking from his dream, Alex suggests to Marty, Melman, and Gloria that they should go to Monte Carlo to get the penguins to fly them back to New York City, which they agree to.
In Monte Carlo, the penguins and the two chimpanzees, Mason and Phil, disguised as the King of Versailles, keep winning in gambling until Alex's gang's attempt to reach them blunders and sparks chaos in the Hotel De Paris. The hotel security calls Monaco Animal Control officer Captain DuBois to deal with the animals. But rather than capture them alive, DuBois desires their heads, mainly Alex's, as trophies. During a high-speed chase between the relentless DuBois and the animals in a modified truck driven by the penguins to reach their aircraft, the animals just barely manage to elude her, since she obviously has superpowers and great ninja skill.
In the skies of France, the plane's engines fail and the plane crashes into a suburban rail yard as the authorities close in. Seeing their only chance of escape is on a circus train, the four Zoosters desperately claim that they are circus animals themselves, which convinces circus friends Stefano the sea lion and Gia the jaguar whom Alex is smitten with upon first sight of to let them in despite the protests of Vitaly the tiger. The animals soon learn from Stefano that they are performing in Rome and London, where they plan to impress a promoter to get them on their first American tour. Before the zoo animals' claim is discredited, the penguins suddenly appear with a deal to purchase the circus themselves,unfortunately, the penguins payed too much to the owners, resulting in the departure and early retirement of all the humans. Meanwhile, Julien falls in love with Sonya the bear and goes on a city tour across Rome while the others prepare for the performance at the Colosseum.
Unfortunately, the circus proves to be so terrible that the disappointed audience demands refunds, to going to the point of chasing the circus to the departing train to London. En route to London, the Zoosters are in despair of having wasted their money on the failing circus and not any closer to getting home. Stefano soon reveals to Alex that Vitaly was once their inspiration.
Once a professional ring jumper who used to leap through incrementally smaller hoops to excite crowds and was always pushing himself to the limit, his attempt at an impossible jump through a flaming pinkie ring ended in disaster when he burned his fur, which he had coated in Extra virgin olive oil in order to slip through the narrow opening, destroying his confidence in his talent and the whole circus suffered by his example. An inspired Alex then has the train make a stop in the Alps and convinces the performers to rework their act to become the opposite of the world-famous human-only Cirque du Soleil as an animal-only circus. Heartened by Alex's vision, the Zoosters and the circus animals develop sophisticated acts together and becoming closer friends in the process, especially Alex and Gia who find themselves falling in love.
Meanwhile, DuBois is arrested & detained in Rome after causing problems with the local police officers while chasing the animals out of her jurisdiction when attempting to get to the Colosseum the very night they'd been in Rome, but escapes and researches Alex on the Internet, learning he was the missing lion from the zoo in New York. Once free, DuBois recruits her injured men and heads toward the Alps, forcing the animals to proceed to London despite incomplete rehearsals. In London, the troupe prepares for the promoter in the audience, but Vitaly is discovered packing to leave. Despite the tiger's hostility to him, Alex convinces Vitaly to stay by reminding him of how he enjoys performing the impossible and suggests that he uses hair conditioner as a safer lubricant to perform his flaming ring jump.
As a result, Vitaly's stunt is performed perfectly, which proves to be the opening of a spectacularly successful show. After the impressed promoter arranges for an American tour, DuBois shows up with a paper showing that Alex was missing. Though the penguins are able to foil DuBois's plan to capture Alex, the lion is forced to confess that the four of them are just zoo animals trying to get home, disappointing the others who feel used by these lying amateurs who could have gotten them killed developing and performing their new acts.
Finally, both the ashamed Zoosters and the circus arrive in New York City. However, Gia, Vitaly and Stephano find that even after learning the truth about Alex's gang, they are ready to forgive their new friends without whom their lives and performances feel woefully incomplete. Likewise, the Zoosters and Julien finally arrive at the gates of the closed Central Park Zoo. Staring at their small enclosures, they realize that their time traveling and exploring has changed them too much to just return to captivity, and they decide it might be better to go back to the Circus. Unfortunately, they are then tranquilized and captured by DuBois. The zoo staff, delighted by Alex's reappearance, thank DuBois, incorrectly believing that she was trying to return the missing animals. Not being from the zoo, Julien manages to reach the circus (despite being darted by DuBois, which causes him to be delusional) and the penguins realize that the group had been ambushed upon noticing the dart on him.
Upon learning about the Zoosters' plight, Gia and Vitaly convince the circus animals to rescue their friends and they set out for the zoo, performing aboard a flying circus, with the rescue mission dubbed "Operation: Afro Circus Rescue." Meanwhile at the zoo, Alex awakens to find that he along with Marty, Melman, and Gloria are back in their enclosures, and worse, they are now surrounded by tall chain-link fences with barbed wires to keep them from escaping again. DuBois steps on stage to receive a million-dollar check of appreciation from the zoo, but at the same time secretly loads a poison-filled dart into a gun which she hides inside a foam finger in preparation to kill Alex. The circus animals arrive in time to stop her and a massive brawl occurs where the circus uses all of what they had developed as part of their revamped act. As the group tries to leave, DuBois attempts to kill Stefano, who is stranded at the zoo. However, Alex saves Stefano and all the animals then defeat DuBois and escape.
Realizing that they truly belong with their new friends, Alex and his friends decide to join the circus permanently. With the circus reunited, the animals all happily proceed with their American tour. Meanwhile DuBois and her men find themselves, oddly enough just like Alex and his friends in the first film, inside crates on a cargo ship bound for the island of Madagascar.
- Alex - the main protagonist
- Stefano - the deuteragonist
- Gia - the tritagonist
- Marty, Gloria, Melman, King Julien, Maurice and Mort - the tetartagonists
- Chantel DuBois - the main antagonist
- Vitaly - the secondary antagonist
- Sonia - the tertiary antagonist