Yes, you can use your HSA to pay for gas if it is directly related to a medical expense.
There are two methods to calculate this deduction: using the standard mileage rate of $0.16 per mile for a personal vehicle, or by allocating actual expenses related to the use of the vehicle for medical transportation such as parking fees, tolls, gas, and oil.