Arduino YUN server crashes after few hours!
Updating your YUN might solve this problem. It is recommended to update it after you buy it because they usually come with old firmware. Make sure its up to date. 
Here a link on how to do this

Another thing to try is to add delay(50); at the end of the loop() function. It prevents the processor from doing lots of work.