You do not say the make or model of the fire but no matter...
You do not say if - as well as switching off spontaneously - weather it also switches on of its own accord - what you do to get it to come back on again.
The problem may be down to a fault inside the fire itself - wiring - switch - heating element.
Or it may be external to the fire - power cord or plug.
It could be nothing to do with the fire and be caused by a fault with the power socket you plug it in to.
Start by eliminating the easiest things to check - plug it in at another place - wriggle the power cord to see if it's a bad connection in the plug - apply mild force to the fire (bash it about a bit).
The fire may have an overheat safety cut out switch - this may be operating either when it should or possibly incorrectly.
Nobody here can see your fire so you will need to make the diagnosis.
Good luck...
November 2014