When translating "he thinks I bought three books, but I didn't buy anything", do we add a completion 了 for "bought"?
which gives a contradiction.

There is no contradiction. Everything described in &quot;他以为 (he thought)&quot; is hypothetical.
Similarly, everything described in [He said: &quot;....&quot; ] doesn't need to be in the same universe with the rest of the text.

Nothing wrong with '他以为我买了三本书，但是我什么都没买。' (The fact -- 'you bought three books' is in his mind only)

'我看着我买了三本书，但是我什么都没买。' would be contradicting (The two facts cannot be both true)

'他叫我买了三本书，但是我什么都没买。' would also be contradicting. It has to be '他叫我买三本书，但是我什么都没买。' ('told you to buy' cannot be changed to 'told you to have bought')