Shuts off in mid cycle light stays on

[SIZE=3]My Maytag Legacy Series electric dryer is shutting off during the drying cycle. The inside light remains working and the dryer will start working again after the machine sits for a while. The thermostat has already been replaced as we suspected it to be the problem. Please help as we have a lot of wet clothes:confused: .[/SIZE]