If want to get into the language of the verse, as you believe that
(Excerpt below from: The Grace New Testament commentary)
that refers to faith since it is the nearest antecedent, with the idea that faith is a gift from God. However, the Greek word that is neuter and the greek word faith is feminine. Demonstrative pronouns normally match their antecedents in number and gender. It is better to see the pronoun that referring to the entire clause, stating that by grace a person is saved through faith. Salvation (Eternal Life) is not of oneself; it is the gift of God, lest anyone should boast.
John 4:10 Jesus answered and said to her, “If you knew the gift of God, and who it is who says to you, ‘Give Me a drink,’ you would have asked Him, and He would have given you living water.”