I wouldn't ever keep leos together, but if, hypothetically, I were to do that, I wouldn't keep more than three in a 40 - maybe no more than two. I'd need to look at it in person. Definitely wouldn't go to four.
Remember not all geckos get along. So even if you were to keep 3-4 in the same tank, there's no guarantee they'll get along well. So keep that in mind before you go out there and get 4 random geckos to put them into the same tank. If you find a feisty female that likes to bite at anything that moves, you'll have to separate her.
3-4 in a 40 gallon is doable. But if you were to find 4 compatible females, and they tolerate each other well, you could get creative and build a second level in the terrarium. I've seen people build a sturdy second level, which effectively doubles the floor space for the geckos inside.
Definitely what the others said as well. I have my Leo, Gaia, in a 40 gallon tank and If I were to ever keep other Geckos with her I'd top it at 2 in that tank.
I had my geckos all separated and had already introduced them all to each other. All of my geckos(total of four) have gotten along great. Their new setup is a 40 gallon terrarium. Two of them were clutch mates and have almost always been inseparable. They definitely have more than enough room and plenty of hides.