The medication may take a couple of days to fully get out of the system, so what you may have been seeing is an improvement off one of the meds, or just because he wasn't eating (and eating is causing the reflux)

I would have to agree with the other posters that 40mg is way, way too high for a 6 month old. We see a specialist gastro dr and she is hesitant to put my 4 year old on 30mg. Unless he is on it because of inflammation or gastritis (as shown on an endoscopy) I think your dr has made a mistake with dosing.

I would try and get the dose reduced to 20mg (which is an adult dose by the way) you may find an improvement in the fact that the losec is working, but because the dose isn't so high not getting so many side effects like sore tummy, etc...