Whirpool Gas Dryer/Drys sometimes

My Whirlpool dryer stopped heating when I had it on the Automatic Dry Setting so I used the timed setting and it worked fine for a couple of months, but in the past week I noticed that on the timed dry it never heated, but it doesn’t happen every time?? Ideas?? Suggestions??