The "G" stuff the other mom was thinking of is Glycolax, which is just generic Miralax.
I would stay away from any kind of medicine, he's only 2 and this happens. Lots of apples, raisans, and grape juice too (only the 100% kind though). My son has problems sometimes with his stool being too large to pass, and when it does it hurts him and makes his bottom bleed a little. His pediatrician has always gone the natural route before he prescribes stuff, which I love about him.
Anytime you give fruits and juices you have to remember they are naturally high in sugar. Make sure its not late at night! Also juices are deceptively not 100% juice, including those horrid V8 drinks (splash, etc) might have a full serving of fruit but also have an enormous amount of sugar in them. Might as well give them a gallon of Mountain Dew to drink! Find a natural grape juice, like at a local health store or GNC, that's 100% juice, not from concentrate. Apples have always worked very well for us too.
Too much sugar can lead to loose stools though so moderate; yogurt is great for the runs, and in general. It cleans out the intestines and gets your body the healthy bacteria it needs.