This goes a bit against common advice but it's something I have had good success with: Be honest. Enforce only things that need to be enforced. That is, if it's really not necessary to leave now let them play another five minutes. Don't insist just in order to assert authority, or just in order to establish and follow rules.
This latches on to another answer here which encourages parents to be polite and say "please" because it gives the children the feeling that they have a choice. This strategy will be more effective if they indeed do have a choice! They can decide to please you and stop, or ask for some extension, and if there are no compulsive reasons to leave right now, there may be another five minutes, and we'll have dinner a a little later. Perhaps that means less reading time in bed though! This is a bit of a give and take: If the parent senses that the child has a particularly good time they'll be more willing to readjust their plans; if they feel the child is only whining, not so much. This way honesty is rewarded and encouraged in both partners here.
The reason this goes against common wisdom is that children allegedly won't be able to understand that one time their pleading is successful, and another time not — that they cannot recognize real urgency. They would throw a tantrum every time, hoping to convince the parents this time as well, and therefore we should not give in to pleading once we made the request to stop the activity. Be consequent! is the mantra.
But I think even small children have a good sense whether one is honest with them or not, and can tell when you really mean it. Reportedly dogs are able to tell whether their owner is only pretending or not: When the owner is only going through the motions of putting on a coat etc. in order to fool the dog the dog stays put in their place; if and when, instead, the owner goes out for real the dog will be happily waiting at the door.
My son certainly could do what the dog could. He could sense a true air of urgency and usually went along. He also knew that I'd accommodate him if it were possible.
Children can tell whether something really needs to be done. Knowing that ending this activity is not arbitrary but necessary will make it easier for them to go along with it.