Sayyiduna Anas bin Malik (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) prayed the night prayer in his room. Some people from among the Companions began to pray along with him (peace and blessings be upon him). He (peace and blessings be upon him) shortened the prayer and went into the house. Then he came out, and he (peace and blessings be upon him) did this several times: he (peace and blessings be upon him) would pray and then leave. In the morning the people said to him (peace and blessings be upon him): O Messenger of Allah! We prayed with you (peace and blessings be upon him) last night, and we wish that you (peace and blessings be upon him) would lengthen the prayer. He (peace and blessings be upon him) said: "I knew that you were there, but I did that deliberately."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5241