Apparently Yorkies are the hardest dogs to house train. Keep at it. Suzy still has accidents inside and she's 7 months old now. All I can suggest is trying to keep your carpets cleaned regularly, I do mine every 2 weeks and get some sort of product that eliminates the odour so your doggy doesn't smell the urine in the carpet and repeats the action.
Have you tried belly bands? A lot of YT members seem to have had success with this.
I'd hate to think that you'd have to rehome him over something like this.