Sayyiduna Ubayy bin Ka'b (may Allah be pleased with him) narrates that the Prophet (peace and blessings be upon him) used to observe i'tikaf in the last ten (days) of Ramadan. One year he (peace and blessings be upon him) was on a journey and could not observe i'tikaf, so the following year he (peace and blessings be upon him) observed i'tikaf for twenty days.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصيام / 8564