This might sound a bit harsh, but "lock" her in the room. This works like a charm for my son, although at 2 1/2, he's quite a bit younger than your daughter.
I suggest putting on child-proof doorknob covers (if you have knobs) so she can't escape.
If she's able to figure the doorknob covers out, and she might be if she's almost 4, get a door handle that locks from the outside.
If you get a door handle that locks from the outside, be sure and put an anti-pinch safety guard finger protector device in a high-up location on the door during the day (the type that slide on and off) to prevent the door from shutting so she can't lock anybody else in there at other times, even by accident.
I've learned with my son that sitting in his room with him won't make him go to sleep because me being in there is a distraction. If nobody is in there with him, if it's dark and if he can't get out and here's nothing to do, he'll go to sleep. Expect crying for a few days, but it won't last long if you're consistent.
I also suggest taking toys out of the room at night or putting them out of reach. Those are another distraction. The fewer things in the room, the better.