The other day I was chatting with a friend of mine whose child is at risk of going off the derech. He is a wonderful person, a talmid chochom, spends a lot of time with his children, is a beacon of chesed and his wife is a devoted mother and Torah teacher.
Is it his fault that his son is wavering? Clearly not!
Is it the neighborhood's fault? He lives in the frummiest neighborhood in town!
School's fault? Most kids in the school are doing just fine religiously!
So whose fault is it?
Answer: Why blame??! Maybe nobody is at fault!
There are quite a few wonderful families who have a child or more at risk. People like to blame the parents but frankly, very often the parents are guiltless. Sometimes, the parents are horrible - then they should take some of the blame. Otherwise, it's really not their fault.
So the bottom line is - have a loving relationship with your spouse, set a good personal example, spend quality and quantity time with your child, don't pressure him too much, make sure there is firm loving discipline, moniter [or ban] use of technology such as facebook, send him to a good school and daven a lot.
The rest is out of your hands.
[PS - This post doesn't contradict but complements the previous post.]