Sayyiduna Anas (may Allah be pleased with him) narrates that when he (peace and blessings be upon him) was resident, he would observe i'tikaf for ten days in the last ten, and when he (peace and blessings be upon him) travelled, he observed i'tikaf for twenty days the following year.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصيام / 8565