The spark plug gap can affect gas mileage, but the impact is generally small. A wider spark plug gap requires more voltage to jump the gap, which can put a strain on the ignition system and reduce fuel efficiency. However, the difference in gas mileage between a properly gapped spark plug and one that is slightly too wide or too narrow is typically negligible.
In general, it is best to follow the manufacturer's recommended spark plug gap. This will ensure that the spark plug is operating at its optimal level and will help to maintain good fuel efficiency.