Rashi brings a gematria at the beginning of Parshas Vayishlach:
גרתי בגימטריא תרי"ג, כלומר, עם לבן הרשע גרתי, ותרי"ג מצות שמרתי, ולא למדתי ממעשיו הרעים
Now, if one takes this literally, it is attesting to the fact that Yaakov actually kept all the laws of the Torah. (See herehere.) Let us assume this opinion. [According to others, though, I understand that it may be simply an allusion to the fact that Yaakov remained righteous even though he lived in Lavan's estate.]
But, we know that Yaakov in fact did not keep all the mitvos of the Torah. He married two sisters. Now, although clearly many reasons are givenmany reasons are given to explain his ability to do so, he still cannot say "תרי"ג מצות שמרתי" if one of the 613 was explicitly violated. How can he say that?