We spent hours lying next to DD waiting for her to go to sleep, and had the frustration along with it. I don't have a failsafe solution, it is still a work in progress here too, but we had some success (especially when we have the energy to be consistent) in getting her settled in bed, 3 books etc, and then leaving for progessively longer periods, but returning before dd got up or started mucking up or getting upset.

At first, it was only getting up from the chair and then sitting back down again. Then, saying 'just need to get something' and be back in a few seconds. slowly extending the time, but returning before chaos hit or it all started again. SHe got lots of (calm) kisses for staying in bed. She could read or play with her teddy or whatever, cos i think she needs that to wind down, but she learnt she could do this without us sitting there.

i think you said he wa on a mattress on the floor. Maybe having him in a bed would create a bit more of a barrier between in bed and out, and so he would have to do more to get out? DD was in a bed at that age with a safety barrier and a step for her to get in and out. To get out though, she had to climb down the end of the bed and then on to the step, so it gave us a bit more time to 'catch' her in bed,

ok, kids calling....