In New York City, Frank Herlihy is accidentally killed by getting hit by a bus while trying to buy an apartment for his mistress. A short time later, anti-social dentist Bertram Pincus is dead for seven minutes under general anesthesia during a colonoscopy.
Afterwards, Bertram can see and communicate with ghosts, who pester him to help them with unfinished personal business. Frank promises to keep the other ghosts away if Bertram breaks up an engagement between his widow Gwen, a professional Egyptologist, and Richard, a human-rights lawyer who Frank says is dishonest. Bertram eventually agrees, trying to woo Gwen away from Richard. His past cold-hearted behavior towards Gwen makes it difficult, but he attracts her interest by analyzing the teeth of a mummified Egyptian Pharaoh she has been studying.
Bertram has dinner with Gwen and Richard, deciding that he is not so bad, but he himself begins to fall in love with her, and she enjoys his sense of humor. As Richard has a work emergency, Bertram and Gwen walk her dog and go for a drink. They share their sad stories of their last relationships, and Gwen reveals that she learned of Frank's mistress the day he died.
When Richard visits Bertram for some dental work, Richard mentions there was a little trouble between him and Gwen but Richard decides it's personal and won't discuss what's bothering him. So Pincus decides a little nitrous oxide would help and he learns that 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 key chain from a fancy jeweler's, but he mistakenly reveals information about her that only Frank could have known. Gwen demands the truth, and Bertram tells her the whole story about the ghosts. She doesn't believe him and demands to know what Frank's worst nightmare was, and Frank lies to Bertram, leading Gwen to cut him off.
Bertram sinks into a deep depression when he asks his colleague Dr. Prashar for a prescription for pain medication and Dr. Prashar 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.
Realizing Frank cannot leave because Gwen has not let him go, Bertram confronts her and while trying to persuade her to believe him about the ghosts, gets hit by a bus. Now a ghost himself, he watches with Frank as a crowd forms and Gwen sobs over him, and Richard arrives to perform CPR. Seeing how upset Gwen is and realizing she cares about Bertram, Frank gives him the piece of information Gwen asked him about earlier that he provided Bertram with the wrong answer to and finally leaves earth.
Bertram ultimately survives the accident. Some time later, Gwen stops by Dr. Pincus' exam room welcoming him back and telling him she decided not to go on the archeological dig. He asks about her dental issue, a problem with 'molar contact' and when she mentions she still has it, he welcomes her to his chair and she tells him she made an appointment with Dr. Prashar, to which he replies, he's a "lovely man" and "a better dentist, but don't tell him I said so." He then tells her of Frank's real nightmare—that of going into the forest with his father when he was 8 years old and getting separated from his father and losing his way home, which was the answer Frank finally told him. Bertram then assures her that Frank has "found his way home