There are two approaches you can take to this very common problem.
Either will work. One is more work than the other. And some people say one is more gentle and humane than the other.
You will need to choose one technique and consistently apply it.
(1) Use your knee
This is the one that even non-dog owners know about.
The dog comes up to you, quivering with excitement. He rears up to place his paws on your stomach or chest. You turn sideways just before he is able to put his paws on you, and raise your knee so he meets a hard, pointed-but-blunt object. After hanging on that for a second or two he drops to the ground. You win.
There are a couple of extra things you can do at this point.
You can teach him that he gets a pleasant reception when his four feet are on the ground, by squatting down next to him when he has dropped off your knee and giving him a lot of attention and fuss.
And if he gets his paws on your before you can raise your knee, then do everything you can to appear uninterested. Don’t reward your dog in any way. (and that means not pushing him away with your hands, as this is an enjoyable game for any dog. Don’t talk to him. Ignore him. make what he wants to be a game, a definite non-event.
OK. that’s the knee in the chest. But there’s an alternative.
(2) Use your hands
When the dog jumps up, this second technique has you catching hold of his legs with both hands — and standing there. His jump has suddenly got ‘frozen’. Nothing is happening. There was no reaction. Instead, he’s been caught and can’t do anything!
Keep him like that. Hold on to him and don’t move. Draw this out. Make it linger for as long as you can. Talk to him if you want to, but hold him up.
Most dogs, after some time, will start to slobber on your hands. This is your signal — drop him. Hard. Don’t lower him to the ground, but rather, let him go abruptly.
Then, when he’s down on the ground squat down there with him and give him the encouraging, enjoyable time he was hoping for by jumping up a few moments earlier.
This way he learns that the best reaction from you is always when he’s on his four legs!