having a dog sleeping in the same room as you is wrong for starters, put him in a bed & leave him in the kitchen & shut the doors, the dog will still whin for a couple of weeks. he will know after that he has to sleep in there.
Dogs are like babies you have to keep at it or they will run rings round you.
good luck