In New York City, Frank Herlihy is accidentally killed by getting hit by a bus (after narrowly avoiding a falling air conditioner moments before) while trying to buy an apartment for his mistress. Shortly after, anti-social dentist Bertram Pincus technically dies for seven minutes under general anesthesia during a colonoscopy.
After, he can see and communicate with ghosts. They pester him to help them with unfinished personal business. Frank promises to keep the other ghosts away if Bertram will break up an engagement between Frank's widow Gwen, a professional Egyptologist, and Richard, a human-rights lawyer who Frank says is dishonest. He eventually agrees, trying to woo Gwen away from Richard. Bertram's past cold-hearted behavior towards Gwen makes it difficult, but he attracts her interest by analyzing the teeth of a mummified Egyptian Pharaoh that she has been studying.
Bertram has dinner with Gwen and Richard, deciding that Richard is not so bad, but he himself begins to fall in love with Gwen, and she enjoys his sense of humor. At another dinner, Gwen reveals that she learned of Frank's mistress the day he died, and when Richard visits Bertram for some dental work, uses laughing gas to make him talk: Gwen has broken their engagement. Frank doesn't understand why he is still on Earth if his "unfinished business" was to break up Richard and Gwen.
Gwen, no longer engaged to Richard, accepts work at an archaeological dig in the Valley of the Kings for six months. As a going-away present, Bertram gets her a new key chain from a fancy jeweler's, knowing that she desperately needed one. But when he mistakenly reveals information about Gwen that only Frank could have known, she demands the truth, and Bertram tells her the whole story about the ghosts. Gwen doesn't believe him and demands to know what Frank's worst nightmare was. Frank lies to Bertram, telling him a fake nightmare, and Gwen, thinking that Bertram has been lying to her, walks away and cuts him off. Bertram asks why Frank lied to him about the nightmare, and Frank points out that Bertram only cares about himself.
Bertram sinks into a deep depression and asks his colleague Dr. Prashar for medication that will help him forget Gwen. Dr. Prashar instead convinces him that his life would be better if he decided to stop being cynical and start helping people. Bertram begins helping the ghosts around him with their "unfinished business" on Earth, bringing comfort to people they left behind and enabling the ghosts to depart. As he does this he realizes that the ghosts were still on Earth not because they had unfinished business, but because the people they were close to were not finished with them. He begins to appreciate life and the people he encounters.
Bertram realizes Frank cannot leave because Gwen has not let him go. He confronts her, who asks him to ask Frank why she wasn't enough for him. Frank says he is sorry for hurting her, which Bertram tells Gwen. She is incredulous that after his infidelity, all Frank would have to say was 'sorry' and thinks that Bertram is mocking her. He rushes after her and while trying to persuade her to believe him, ironically gets hit by a bus. Bertram, now a ghost himself, watches with Frank as a crowd forms and Gwen sobs over him. Richard arrives on his way to the reception and tries to revive Bertram with prayer and CPR. Seeing how upset Gwen is, Frank gives Bertram 'some advice' that will be useful in case he is resuscitated, and implies that Gwen loves him. After saying this, Frank finally leaves earth.
Bertram wakes up in the hospital. Later Gwen, who needs dental work, comes in for an appointment with Dr. Prashar but finds Bertram's office to say hello. Bertram tells Gwen of Frank's real nightmare—that of losing his way home, which was the advice Frank told him, and then assures her that Frank has "found his way home". When Gwen tells him, "It hurts when I smile", Bertram replies "I can fix that for you".
Ricky Gervais as Bertram Pincus,
Téa Leoni as Gwen,
Greg Kinnear as Frank Herlihy,
Billy Campbell as Richard,
Kristen Wiig as Bertram's self-involved surgeon.
Dana Ivey as Marjorie Pickthall
Aasif Mandvi as Dr. Prashar,
Alan Ruck as the ghost of a family man
Betty Gilpin as World War II Nurse
Brian d'Arcy James as Irish Eddie
Brian Tarantina as Ghost Cop
Jeff Hiller as a naked ghost.
Michael-Leon Wooley as a medical attorney.
Aaron Tveit as the anesthesiologist.
Bridget Moloney as the receptionist.
Joey Mazzarino as food delivery guy.