The exercises suggested by Alexus sound good... In regards to what issues you're having:
One of the biggest requirements in regards to maintaining good position in a squat is the ability to externally rotate your hips (ideally through a full range of motion). From what you've described, it sounds like this is what you're missing. Your feet kicking out to the side is your bodies way of compensating for this lack of mobility in your hips.
A test: sit on a chair, or on the edge of your bed, or anywhere where the joints (hip and knee) form roughly a 90 deg angle. Cross one leg over the other, so that your ankle is resting on your quad, just behind the knee. Make sure you keep nice and upright, with the spine in a neutral position (the temptation will be to either lean back or away from the leg you're crossing). The knee of this crossed over leg SHOULD fall easily to parallel with the floor/perpendicular to the floor. If it doesn't, boom - there's your missing external rotation. How far away from parallel is roughly how much you're missing.
The stretch: Keep this position, and now do one of two things: Place your hand on the knee of your crossed leg. Push the knee downwards towards the floor until you get to the end of your ROM and hold. The longer you hold, the further you should be able to push it down. OR, you can maintain the neutral, perpendicular with the floor position of your spine, and fold forwards at the hips. If you're doing it right you should feel a "good" stretch in the outside part of your arse.