As stated by others - get a good power supply for the PI.
Mine has been rock solid for several years since I got a decent (Canakit 2.5A for <$10 ) power supply.
Prior to that I was getting monthly SD card corruption using just any old 5v USB phone charger power supply.