Over the last 3 years my blood sugar has gone from 6 to 7 to 9. My doctor advises going on medicine (pills) is it possible to control this with diet or?

Diet not working! Your case illustrates quite clearly that type 2 diabetes is a progressive condition so that what worked at one time is no longer sufficient. Your sugars are now 150% of where they were 3 years ago. Certainly, if you've not been following your diet & exercise plan, you should work on this, but if you're lifestyle is good, and your sugars are high, meds are needed.