Automatic sensor setting not working.

I am not sure how old the dryer is since I got it used. But as of right now the automatic cycle timer will not advance. The clothes get extremely hot but it wont shut off. It dries but is extremely hot and there was smoke comming out of it the last time it was used, I think from lint burning. The timed dry cycle advances but it does not seem to get as hot and takes a long time to dry. I have read about the moisture sensor needing to be replaced but I am unsure where to start.