All my photos, but mainly replays are gone and it's a third time it happened now. I guess there is probably no chance to get them back, but why does this even happen in first place? Is there any way to avoid it?
Possibly. Did you have any replays copied to your Collection? If not you can try that. Or, you can try copying them to another PS4 account. See this thread: