Maytag Dryer *usually* won't heat

My dryer suddenly stopped working properly a few weeks ago. It runs fine, but it won’t consistently heat. Most of the time it won’t heat at all. Sometimes it produces heat for the entire load (it worked consistently for three days recently, and then stop working again). And sometimes it produces heat for part of a load. I checked all the usual culprits that can be accessed by opening up the back of the dryer. Continuity was fine on all the parts and voltage is 240 and the vent is clear and air passes through it just fine. I decided to replace the main fuse, the cycle thermostat, the hi-limit cutoff and heater thermostat (pair) and the heating element since these parts all together don’t cost too much. But this did not help. Any ideas anyone?