I have just had the boiler serviced and the pilot light took ages to light then after a while would go out, so i replaced the thermocouple and lights easier now but after the heating been on for a while then switched off after a while the pilot light goes out, i am a bit puzzled as to what is happening.

hi you do not say what make of boiler it is, and this is important, because a lot of boilers had copper low content heat exchangers and it sounds like you have a common problem that happens with these as they get older, they tend to get corroded inside so when the heating is on its ok,, but when the heating goes off the latent heat in the heat exchanger has to dissipate out this is normally via the pump overun stat that runs the pump for 3/4 mins after the boiler has turned off,
However sometimes system were wired up from the start and the pump was never wired direct to the boiler, if not this causes the corrosion insde ,, So back to the problem the water left in the heat exchanger now becomes higher than the temp of the overheat stat which in turn is coupled with and interupter which for safteys sake knocks out the pilot light
So i should get the R G I to check to see if the pump overun stat is working or if the pump is wired correctly to the boiler

Should the thermo sit in the pilot or should there be a small gap between. Mine has a 4 mm gap and am wondering whether this is to far so when there is draft hitting the flame away from the thermo it cools and turns off, is this possible.?