How do I fix and prevent a baked custard from weeping?
Why did this happen?


One possibility is that the outside of the custard became overcooked while you were waiting for the middle to set. As eggs cook longer they tighten up more and more, squeezing out liquids that were previously captured by the protein matrix. The cooking process continues for a while even after you remove the custard from the oven, so the overcooking might have happened later than you'd think.


  What could I do to avoid it happening in the future?


If the overcooking hypothesis is correct, then any of the following could help:


Reduce the cooking time. Most custard recipes that I can think of call for cooking times around an hour, depending on the size of the dish.
Use smaller baking dishes. With a smaller dish, you won't have to wait as long for the center to set.
Use a shallower baking dish. Same as above -- cooking the custard in a thinner layer should help the whole thing set more quickly.
Remove from oven before it's completely done. With some recipes, like cheesecake, you need to remove the item from the oven before it seems to be done. This prevents overcooking at the edges and cracking in the middle. The same idea could work for your custard.
Modify the matrix. Many custards contain ingredients like starch or gelatin, which can fortify the protein matrix that gives the custard body.