How to stack protoboards solidly?
Use male and female headers.

Female header with short pins:

(Image from grobotronics.com)



"Stackable" female header with long pins that go through to the next board (or can be simply cut to length).

(Image from sparkfun.com)

Observe that the stackable pins are sort of "flat", and due to their length, have some bend to them. 



Male header:

(Image from solarbotics.com)

These headers are more "square" than the stackable variety, which makes them stay mated better, and they are less bendable. 

Note that male headers can but cut or snapped-off to the exact pin count desired. Female headers can be cut, though it is not nearly as convenient (and will probably look bad). 

When the headers are mated (the boards stacked), there should be some rigidity, depending on how many pins. Double-row headers will have even more rigidity. Having headers in two places on the same board offer even more rigidity (removing the possibility of the header bending/acting like a hinge).

Typically, they do not fall-out on their own, even with vibration, though if put in a vehicle for years, you may want to secure them further (See below).

The end result when using the long-pinned stackable headers:  


(Image from adafruit.com)



If that's not enough, you can combine the headers with standoffs between boards:


(Image from robotroom.com)