Failing that, try a factory reset of the phone. However, if it keeps happening then it could be a sign that your motherboard is failing and they'll need to replace it. I had similar problems with a different Samsung phone and eventually one day it kept freezing and restarting every 30 minutes. Then it wouldn't turn back on at all. The main board needed replaced.