There are currently two main methods for choosing the gender of your babies. One requires a cheat, and one requires patience. There had been a hack available to do this at one point, but it apparently has issues in the game, so the methods below are the safest ways to do it right now...
The Cheating Way:
It has certain limitations, but if you really need a girl or boy to balance your neighborhood, here's how:
Load up the lot of your choice. Press CTRL, SHIFT, C at the same time to bring up the cheat console. Type "boolProp testingCheatsEnabled true" without the quotes and hit ENTER. Cheats may be case sensitive, so make sure you enter the caps exactly as shown or it may not work for you.
Now, go into live mode unpaused and SHIFT-click on one of your sims. You'll see a bunch of options come up. You may have to click "More" but one of them should be "Spawn." Under that, choose, "Tombstone of L&D."
A tombstone will appear next to your currently selected sim. CTRL, SHIFT, C again and type "boolProp testingCheatsEnabled false". Make sure you do this right after you spawn the tombstone as the cheat you're using can cause problems if you leave it on longer than you need it.
Now, you'll choose your baby's parent. If you would like a girl baby, choose a male sim for the parent. If you would like a boy baby, choose a female sim for the parent. With your parent sim selected, in live mode and unpaused, click on the tombstone and choose "Impregnate." It'll give you a list of all the sims on the lot. Choose the name of the sim you have currently selected. This will impregnate your sim by themselves.
When the baby is born, it will be a clone of your parent sim, just of the opposite gender. If you would like your family relationships to show your parent sim's spouse as the baby's other parent, you'll have to edit the family relationships in SimPE. Part of this guide
explains how to do so. The memories will not be quite right for both sims (the spouse will just have a 'X joined the family' type memory instead of 'had X' memory) but it'll be otherwise fine.
The Patient Way:
Alternately, if you want a baby to have the genetics of both parents, and the parents to have correct memories, just save before your pregnant sim starts going into labor (before the camera zooms and they start huffing and puffing and complaining) and exit to neighborhood without saving and re-enter the lot until you get a baby with the gender of your choice. It may be a little more tedious, and it may take several tries before you get the gender you want, but it's another solution.
Keywords: baby, gender, birth, cheat, hack