You answered your own question. Thermostat is the only way to go especially if you want to automate things.
What brand of thermostat malfunctioned on you? I'd recommend Herpstat brand just because I have experience with them and they're been proven in thr reptile communit over the years to be very reliable. There's also other proportional thermostats out there that are great as well. One of them being VE Electronics.