When my love swears that she is made of truth,
I do believe her though I know she lies,
That she might think me some untutored youth,
Unlearned in the world's false subtleties.
Thus vainly thinking that she thinks me young,
Although she knows my days are past the best,
Simply I credit her false-speaking tongue:
On both sides thus is simple truth suppressed:
The speaker purports to believe that the Lady believes him to be young, but “vainly”, because he knows that she doesn’t think so. 
 Shakespeare puns on “vainly” to mean both ‘with vanity’ and ‘in vain’. So, the speaker is vain to think she has made him believe her lies, and is also telling the lies in vain, because he knows she is lying.
Sonnet 138