Sounds like the heater needs a full service and the thermocouple lead checked or realigned. If it is a pilot operated unit then that too should be looked at.
Hire the services of a suitably qualified Gasfitter to ensure all repair work is done in a safe and proficient manner. Remember in the hands of those that are not qualified gas can be, and is often dangerous!!!!!!!!!
Selgas Services Ltd
Craftsman Gasfitters, Plumbers, Electrical Service Technicians