(I'm assuming these sentences are all in past context)
1. He failed because he did not listen to the advice of his teacher.
(Adding did will maintain the past tense of the sentence)
2. He learnt that he was ill but could not go to see him.
(Changing be to was maintains the past tense. Could is past tense as can is present tense)
3. He said that he came to our house to discuss the matter.
(Came is past tense as come is present tense)