NEXUS 5 REPEATEDLY SHUTS ON AND OFF (FIXED)
It could be that your battery is failing. Try turning your device off and letting it charge for approximately ten or twelve hours. Then turn your Nexus 5 on and see if it stays on. If it continues to randomly turn off, contact Google and request a replacement handset.