A married couple Josh (Patrick Wilson) and Renai (Rose Byrne), their sons Dalton (Ty Simpkins) and Foster (Andrew Astor), and infant daughter Cali have recently moved into a new home. One night, Dalton is drawn to the attic when he hears creaking noises and sees the door open by itself. He falls from a ladder while investigating and sees a figure in the shadows. Hearing his terrified screams, Renai and Josh rush to his aid and declare the attic "off limits" to the children. The next day, Dalton falls into an inexplicable coma.
After three months of treatment without result, Renai and Josh are allowed to take Dalton home. Soon after, paranormal activity begins to occur; Renai begins hearing voices over the baby monitor when no one is in Cali's room, Foster says that Dalton sleepwalks at night, Renai sees a frightening figure of a man in Cali's room, who vanishes when Josh comes and the burglar alarm is repeatedly triggered for no reason with the front door open. After Renai finds a bloody hand print on Dalton's bed, she questions Josh about the house, but he ignores her. That night, Renai is attacked by the figure from Cali's room, and the Lamberts decide to abandon the house and move elsewhere.
In the new house, Renai sees the ghost of a dancing boy who leads her to Dalton's room. Josh's mother, Lorraine (Barbara Hershey), visits them one day, and says she had a dream in which a figure in Dalton's room replies "Dalton" when she asks what it wants; at the same time, she sees a monstrous red-faced demon standing behind Josh and screams, while Dalton's room is ransacked and Dalton himself is found lying on the floor.
Lorraine calls demonologists Elise Reiner (Lin Shaye), Specs (Leigh Whannell), and Tucker (Angus Sampson). Upon entering, Elise senses a presence in the house and upon entering Dalton's room, she sees something on the ceiling; to which Specs draws the demonic, red-faced figure Lorraine saw.
Elise explains that Dalton is not in a coma; he was born with the ability to travel mentally to the astral plane. He has traveled too far and become lost in a purgatory realm called "The Further", a place inhabited by the tortured souls of the dead. Without his mental presence, Dalton's body appears comatose and spirits can use it to enter the physical world. Josh is skeptical until he realizes that all of Dalton's drawings are of the demonic entity drawn by Specs.
Elise performs a seance to communicate with Dalton, but they contact the demon who threatens them before using Dalton's body to attack them until it is stopped by Elise. She reveals that her acquaintance with Lorraine is decades old, because she previously performed the same service on Josh when he was eight years old (he was terrorized by the parasitic spirit of an old woman). Josh also possesses the ability to astral project, and Dalton inherited this trait from him. Elise tells Josh that the only way to rescue Dalton is to go into the Further.
Elise puts Josh in a trance and he is able to project himself to their previous house. He goes to the attic and finds a red door, but is attacked by the mysterious figure that attacked Renai. After defeating him, Josh enters the Demon's lair, where Josh finds Dalton chained to the floor. After a tearful reunion, Josh frees him, but they are caught by the demon. Josh tries to fight it, but they are forced to flee with the demon in pursuit. Returning through the red door, Josh confronts the old woman that haunted him as a child. The old woman dissolves into darkness after Josh shouts at it to leave him alone. When Josh and Dalton return to their bodies they wake up in their new home and the spirits seem to disappear.
As they celebrate the apparent end of their ordeal, Elise starts packing her equipment with Josh, when she senses that something is wrong (she notices Josh's hands look old and dirty, similar to the old woman's), and proceeds to take a photo of Josh. Josh goes into a violent rage, as he doesn't like to have his picture taken and strangles Elise to death. Renai is horrified when she discovers Elise's dead body and searches for Josh to inform him of her sudden death. Renai picks up the camera and sees that the image Elise took of Josh is the old woman that haunted him as a child, implying that Josh has been possessed. Josh suddenly puts his hand on her shoulder, and she turns around and gasps.

Question: Who had been possessed before?
Answer: Josh
Alternative answer: Josh