I can’t give you a better answer as far as how to "build a big repertoire" with memorization goes, but a couple other considerations around "how not to forget songs" are situational comfort and context.

I’ve learned from experience that it’s difficult to remember things in an unfamiliar situation, especially if I'm nervous. And some times the harder I try to remember under pressure, the further it seems to slip away. An effective trick for me is to visualize the place where I usually practice. Putting my mind in that space settles my nerves and provides cues to my memory. It also distracts from the urgency of trying to un-forget the tune. In this sort of re-set mental state, I can usually collect my wits well enough to get back on track.

Hope that’s helpful.