And the Word of the Lord said to him in a dream, Before Me also it is manifest that in the truthfulness of thy heart thou didst this, and so restrained I thee from sinning before Me; therefore I would not permit thee to come near her.
God Tells Abimelech — I Restrained You From Sinning
Targum Pseudo-Jonathan on Genesis 20:6