My Explanation (spoilers)
Ok this is my attempt to explain what the hell happened in this movie, since it seems EXTREMELY nonsensical.
Mr. Jones was a guardian of the nightmare world/realm. His scarecrow creations kept The real world and the dreaming world from colliding. I don't know why he chose certain people to send them to, but as long as they were seen and noticed it seemed to keep the nightmare world at bay.
We are supposed to think that he is a bad presence when really he is a protector.
Penny and Scott start to meddle. They meddle WAY TOO MUCH. Penny tries to speak to him, they go into his basement and his underground ceremonial area and Scott even takes a "souvenir" doll.
Very bad.
Now they have officially entered the nightmare world, where they are asleep. Penny seems to be in more control to try and wake Scott up, but since he actually took the doll and is off is meds, he has less and less control.
Penny didn't fear Mr. Jones and that is why she tells Scott to open the door when he is trying to get in. Also, she knows that when he dragged her from the forest and brought her home, he actually saved her life.
When Scott opens the door, the two worlds are breached and Mr. Jones is sucked into the nightmare realm. When Scott pulls his mask off and is left with it, he automatically inherits the job of the new gatekeeper.
That's the best I got.
What do you think?