Harry Connick Jr. was cast when he happened to be sitting across from William Friedkin at a Las Vegas hotel opening, and started to "put him on" in a way that reminded Friedkin of the character of Jerry Goss.
The film was shot in July and August of 2005 in Southern Louisiana, and wrapped up only a week before Hurricane Katrina hit the area; the cast and crew narrowly escaped the disaster by only a few days.
According to Lynn Collins, director William Friedkin never took more than four takes to get a scene in this film, and in fact worked so fast that the actors sometimes had to beg him to do a second take when he thought they'd nailed it the first time.
Throughout all the scenes in the motel where the bathroom is visible, we see that the bathroom door is a regular standard door. But in the scene when Peter is removing a tooth, as he goes to enter the bathroom the door changes into a double louvered door. Then changes back to the regular door in later scenes.
When Peter leaves the motel room to dispose of the smoke alarm, Agnes uses the bathroom with the door open and we see that the toilet is directly next to the open door. In later scenes, the sink is in the position directly next to the bathroom door.