Check to make sure that you have a clean blue flame, and the flame goes across the flame sensor electrode. The sensor needs to be right in the flame to work properly.
Often just cleaning the air tube fixes this.
Otherwise, the 'spark and sensor electrode' assembly has gone through a few upgrades, and it might work more reliably if replaced.
Doug and Patience and Shelby the mutt
2015 Crossroads Sunset Trail Reserve ST26RB
2013 Ford F-150 3.5 EcoBoost XLT Supercab 4x4