In this community, the pilot question is often a question about the cupboard.
Air first
Check the openings. A high and low louvre, or a purpose-made vent, is the combustion and dilution air path. In a small house, that space is valuable, and it gets used for storage.
Restore the openings, clear the space, and test again. It is the cheapest repair available.
Then the flame
A weak, soft or yellow pilot will not reliably prove. Clean the orifice, check the flame shape, and test the thermocouple signal.
Then the flue
A flue that rises badly or terminates too close to a wall will not draw. In a closet, that shows as spillage — which is a stop-use finding.
The overnight pattern
Lights at night, out by morning: that is a signal fading as the unit warms, not a supply problem.
When it is the control
If the flame is healthy, the sensor shows a good signal and the pilot still will not hold, the gas control is the remaining suspect. That is a part to prove, not to guess at, because the same symptom comes from air and from a dirty jet far more often.
Safety
If gas can be smelled, everyone out, then call. Soot, scorching or spillage keep the unit off.
What to have ready
How long it stays lit, space condition, vent route.