To housebreak a Yorkie, you will need to take him outside after sleeping, eating, playing. Take him to a spot where you want him to relieve himself. Allow him to sniff around a while and tell him to 'go potty' or whatever phrase you wish to use and when he performs praise him and tell him what a good boy he is and give him a little treat.
It's no use putting him outside and expect him to 'train' himself. He won't know why he has been put outside so it's up to you to teach him. You must stay with him to encourage him.
Always take him out last thing at night before you go to bed. At 2 years old he should be able to hold it until the morning as long as you take him out immediately after he wakes up.
It is going to take a lot of patience on your part but he will soon learn to ask to go outside.