Your thermocouple is possibly not recognizing the pilot flame which is causing it to go out. You will want to clean the thermocouple with a piece of emery cloth or high grit (1000) sandpaper. This may resolve the issue. Another issue that could be causing this is the connection point between the thermocouple lead and the gas valve. Depending on your fireplace, there may be either a pair of lead wires or a solid copper lead that is held in place by a nut. Either way, loosening and cleaning the connection point at the gas valve will often make a difference, as excessive voltage drop can occur at this location and cause the pilot to drop out.