Every time he whines and you give in, you reinforce his whining and begging. As hard as it might seem, the first thing you need to do is get tough and not give in to him.

If you do give in, you are saying "good boy, good whining."
The suggestions to put the treats in a different place are very good. The only thing I would add to that is when you do give him a treat, make him work for it, that is make him do something like a sit or trick of some kind.