Teach your dog that self-restraint is rewarding – just an extension of making choices in general.
Play its your choice games with a chance to go outside, a chance to eat dinner, toys, treats, hide-n-seek etc.
As you play these games, your dog will begin to offer stay behaviors as they choose the mindset of self-restraint - start adding your release word “OK, get it” to tell them when its ok to go for the treat, out the door, head to the dinner bowl etc.
It is important to let your dog choose. You don't correct them, but let them learn to offer the self control to resist the thing they want. If you take responsibility for that decision (by using a command, or social pressure, or restraint), your pup doesn't learn to do it for themselves. And it isn't likely to get learned later on when say, their favorite game is about to happen, or they are supposed to hang out on a table for a while.
A valuable by-product of this training, is that you are building drive as well
The key to teaching self restraint is to present your dog with a choice - exercise self-restraint and you win a reward - choose not to and the opportunity to win the reward goes away.
Start with choices that are relatively easy and once your dog learns to master self-restraint they can not only resist greater challenges but they will love the game because while they are exhibiting self-restraint they are building anticipation for their reward (drive).