Will villagers fall to their deaths or exhibit other suicidal behavior?
Solution 1:
Villagers will not commit suicide without an accomplice, such as a creeper exploding, a zombie pushing them off a cliff, or an enderman enclosing trapping them in a water tube.
Solution 2:
Enough villagers will trigger a zombie siege. In a zombie siege, the zombies can spawn anywhere (on half slabs, in fully lit areas, on water) so no one is safe, unless you have some iron golems or you are close by and actively defend the villagers.
I always keep a couple villagers buried in a covered pit in the ground to avoid complete decimation.
The wiki doesn't state, and I don't have personal experience on the lower limit of villagers required to invoke a zombie siege.
Solution 3:
I've seen villagers stay outside all night in some conditions. They seem to think as long as there's a roof over their heads (even just tree leaves) they are safe. If there are no walls around any overhangs, then it's easy for a roaming zombie to wipe them out. The best defense I have found so far (besides iron golumns that I can not yet afford) is to wall of and light up the entire town. They can't go through iron doors if you use a button to open them.
Be sure to pay special attention to the rules for what defines a "house." It's any door with more covered blocks on one side than the other within 5 blocks. If you put your buildings too close together and make them too thin then the OUTSIDE may be considered an INSIDE space by the AI.
XXXX XXX
| X | X
^
This OUTSIDE space has more roof to the left 5 blocks than the right 5 blocks!
XXXXXXX
| X
^
The overhang counts as a "roof" and therefore the left is considered inside by the AI.
Solution 4:
My villagers stay outside all night staring into my house. It's creepy because they all gather around my house by my windows. I think they think their houses aren't good enough or something.
Anyway, your problem may have been that they didn't think they're houses were light enough so they refused to go in at night. My advise would be to make sure each house is properly light next time. TIP: if villagers keep coming into your house you can fence in a yard and put in a fence gate. They can't open fence gates!