elaheshiraz first check to see if you are running into some software error. Try this option suggested by Microsoft to [http://www.microsoft.com/en-us/mobile/support/product/lumia520/troubleshooter/?categories=Other,Unresponsive&topic=FA141447&showRepair=&showContact=&topic2=FA140265&topic3=FA142987#topic3|recover your software.]
If that does not work, you could try to re-flash your phone or you may have a bad eMMC IC . for instructions on how to flash, check [http://forum.gsmhosting.com/vbb/f609/atf-jtag-lumia-wp8-ffu-flashing-procedure-1854823/|this link.]