As the curtains fall on his thrilling escapades at the American Museum of Natural History, Larry Daley (Ben Stiller) has traded his night guard uniform for an entrepreneurial venture, showcasing his creations on television. However, upon his return to the museum, he learns of a monumental change: numerous exhibits are being moved to the archives of the Smithsonian Institution in Washington D.C., where they will be replaced by advanced holographic displays. The once-enchanting tablet of Ahkmenrah, responsible for the magical nighttime displays, is left behind, rendering its friends—now stripped of their vitality—vulnerable.
Larry's moment of nostalgia is abruptly interrupted by a frantic call from Jedediah (Owen Wilson), who informs him that Dexter the monkey unwittingly transported the tablet to the Smithsonian. They are now under attack by Kahmunrah, Ahkmenrah's menacing brother. Fueled by determination and loyalty, Larry dons the guise of a night guard and sneaks into the archives, only to find his friends ensnared by the villainous Kahmunrah, who has sinister plans to use the tablet's power for world domination.
As the story unfolds, Larry receives unexpected assistance from Major General George A. Custer and Amelia Earhart (Amy Adams), an adventurous spirit with a soft spot for him. Together, they traverse the maze-like corridors of the Smithsonian, evading Kahmunrah's soldiers and navigating through the iconic photograph of V-J Day in Times Square. In response to their audacious escape, Kahmunrah enlists notorious figures like Ivan the Terrible, Napoleon Bonaparte, and Al Capone, each bringing unique threats to the mix.
Larry soon finds himself captured by Kahmunrah, who gives him a dire ultimatum: solve the tablet's combination in an hour or witness Jedediah face a dire fate. During this tense moment, Amelia confesses her burgeoning feelings for Larry, and the two become the subject of affection and intrigue, especially in a surreal encounter with the statue of Abraham Lincoln at the Lincoln Memorial, just before their arrival at the National Air and Space Museum.
In this fantastical arena of flight, they meet an astonishing array of historical characters including the Wright brothers, a group of Tuskegee Airmen, and Able, the space monkey. Here, a gathering of Albert Einstein bobbleheads reveals the secret to the tablet's combination: the value of pi. With enemies closing in, Larry and Amelia make their daring escape in the iconic Wright Flyer, leaving a trail of excitement and chaos behind.
Just as Kahmunrah unleashes countless Horus warriors from the depths of the Smithsonian, Octavius springs into action with the statue of Lincoln, driving the nefarious warriors back into the Underworld. In a determined effort, Amelia begins to rally her own force of unlikely allies, including Larry's quirky friends and Custer himself. As the buildup to an epic showdown nears, Larry helps Custer confront his long-standing fears about the Battle of Little Big Horn. Meanwhile, Octavius heroically rescues Jedediah, while Larry cunningly engineers a rift among Kahmunrah's infamous henchmen, turning them against one another. Armed only with his trusty flashlight, Larry faces an exhilarating showdown with the ruthless Kahmunrah, who wields a foreboding khopesh. Just when despair looms, Amelia reopens the ancient gate, allowing Larry to trap Kahmunrah in the fiery depths of the Underworld.
As Amelia takes to the skies with Larry beside her, she unveils a shocking truth: she is merely a wax replica of the actual aviator, her existence crafted from art. In a moment thick with emotion, they share a bittersweet kiss just before Amelia soars away, leaving Larry to contemplate the wonders of the Smithsonian. Two months later, Larry, having sold his business, anonymously donates to revive the Natural History Museum. Now, by night, the exhibits come to vibrant life, no longer just lifeless figures or hired actors but dynamic, interactive entities. Reassumed in his role as night guard, Larry encounters a mysterious newcomer named Tess, whose striking resemblance to Amelia reignites memories of nostalgia and longing in his heart.