How many negative levels does a creature gain when trapped by a devourer? Does he gain the neg. levels immediately or only when the devourer drains the essence point from the pool (for casting)?
The trapped creature only gains negative levels as the Devourer uses it to fuel its spell-like abilities. It gains 1 negative level for every five uses of its spell-like abilities, so it gains its first negative level the fifth time the Devourer uses a spell-like ability since trapping it, then another on the 10th time, and so on. These are independent from any negative levels gained from the Devourer’s claw attack or spectral hand; a trapped creature is not subject to those effects but might have been subject to them before getting trapped. Negative levels from all of these sources stack, though the Pathfinder version of the Devourer states that when you’re brought back after being trapped, the negative level from being brought back doesn’t stack with those from the Devourer (so you effectively have one fewer negative level than you would otherwise).
As usual, @Kryan hit the nail on the head. I would just add one more thing about gaining the neg lvls..For every negative level the character receives they must succeed on a DC 19 Fort Save or lose it permanently.
While you could technically make force them to make the save (or all of them) immediately upon exiting the Devourer I would allow them atleast one round for a chance to be "buffed" assisting the save. I would also allow 1 round between every save for additional chances. However, I might even allow them to wait until after 1 round of combat (assuming they were freed before the devourer was killed.)