Will Atenton (Daniel Craig) is actually Peter Ward. But he did not kill his family.
Jack Patterson (Martin Csokas) and Boyce (Elias Koteas) did. Jack was divorced from his wife Ann (Naomi Watts) and enraged she would get everything including custody of their daughter, hired Boyce to kill her. But Boyce screwed up, and killed Peter's family instead and inadvertently made it look like he did it.
Jack knocks out Will/Peter and Ann and plans to make it look like Peter killed Ann then set the house on fire. The ghost of Peter's wife Libby (Rachel Weisz) helps him escape and save Ann. Boyce and Jasck wind up killing on another. Will/Peter has one last moment with his wife who tells him to let them go, and Peter escapes the burning house alive.
An undisclosed amount of time later, Peter is living in New York City. His novel "Dream House" based off the murders is a bestseller. It is inferred that Peter has started to come to grips with his family's death and is ready to move on and live his life again.