Malcolm Crowe, a child psychologist in Philadelphia, returns home one night with his wife Anna after having been honored for his work. A young man appears in their bathroom and accuses Malcolm of failing him. Malcolm recognizes him as Vincent Grey, a former patient he treated as a child for hallucinations, but before he can talk Vincent down, Vincent shoots him and then himself.
The next fall, Malcolm begins working with Cole Sear, a young boy. Malcolm feels he must help him in order to rectify his failure and reconcile with his wife, who has become distant and cold. Cole’s mother Lynn worries about his social skills, especially after seeing signs of physical harm. Cole eventually confides his secret to Malcolm: he sees ghosts walking around like the living, unaware that they are dead.
Initially, Malcolm thinks Cole is delusional and considers dropping his case. After listening to an audiotape from a session with Vincent, Malcolm hears a weeping man begging for help in Spanish and believes that Cole is telling the truth. He suggests that Cole try to find a purpose for his gift by communicating with the ghosts and helping them finish their business. Cole is unwilling at first, then finally agrees to try to help.
Cole awakens one night to discover a ghost girl vomiting. After finding out who she is, Cole goes with Malcolm to the funeral reception at her home. Cole is directed to a box holding a videotape, which he gives to the ghost girl’s father. The tape shows the girl’s mother poisoning her daughter’s food. By doing this, Cole has saved the girl’s younger sister from the same fate.
Learning to live with the ghosts he sees, Cole begins to fit in at school and is cast as the lead in the school play. Before departing, Cole suggests that Malcolm should try speaking to Anna while she is asleep. Stuck in traffic, Cole tells his mother his secret, and says that someone died in an accident down the road. When Lynn does not believe him, Cole tells her his grandmother visits him and describes how she saw Lynn in a dance performance when she was a child, giving details he could not have known.
Malcolm returns home to find his wife asleep and their wedding video playing. While still asleep, Anna asks why he left her and drops Malcolm’s wedding ring. Recalling what Cole told him about how dead people only see what they want to see, Malcolm starts to see things he did not see earlier. Malcolm suddenly remembers being shot and locates his gunshot wound that reveals he was actually killed by Vincent and he has been dead the whole time. Malcolm tells his wife she was never second to anything and that he loves her. Because of Cole’s efforts, Malcolm’s business is finally complete, and his spirit departs in a flash of light.