Larry Daley (BEN STILLER) is an ordinary guy and divorced parent who repeatedly disappoints his ex-wife Erica (KIM RAVER) and their ten-year-old son Nick (JAKE CHERRY) due to his inability to hold down a job, live in one place for long, or get any of his inventions to come to fruition.
Accordingly, and when Erica says he probably shouldn't spend any time with Nick until he settles down and after seeing how Nick is taking after Erica's boyfriend Don (PAUL RUDD), Larry accepts a security guard job at for New York City's Museum of Natural History working for museum director Dr. McPhee (RICKY GERVAIS). There, he not only meets docent Rebecca Hutman (CARLA GUGINO) but also the trio of aged security guards -- Cecil (DICK VAN DYKE), Gus (MICKEY ROONEY) and Reginald (BILL COBBS) -- who he learns he's going to replace.
He also discovers that he's been given the night shift as well as written instructions from Cecil about how to perform the job. Larry isn't pleased, but figures it will be a cakewalk. That is, until he realizes that all of the figures and attractions in the museum come to life at night. Among them is a full-size T-Rex skeleton that wishes to play fetch, various African mammals including a pride of lions, and a key-stealing capuchin monkey by the name of Dexter.
There are also wax figurines of several Neanderthals; Attila The Hun (PATRICK GALLAGHER) and his crew; Lewis and Clark's Indian tracker Sacajawea (MIZUO PECK); miniature diorama figures cowboy Jedidiah (OWEN WILSON) and Roman emperor Octavius (STEVE COOGAN); and former President Teddy Roosevelt (ROBIN WILLIAMS).
The latter becomes Larry's friend who informs him of the workings of the museum, including that Egyptian pharaoh Ahkmenrah (RAMI MALEK) should never be let out of his sarcophagus. Beyond that, he tells Larry he should read up on the various historical figures and animals to figure out how best to deal with them over the ensuing nights. Having experienced just one evening of that, Larry wants to quit. Realizing that will mean he'll never see Nick, however, spurs him on.
From that point on, he must not only deal with the various figures, animals and other attractions that come to life every night, but also some thieves who have their sights set on a valuable Egyptian relic.