The Quran Verse
Surah 7:46;
And between them will be a partition, and on Al-A'raf are men who know all by their marks. And they call out to the companions of Paradise, "Peace be upon you." They have not entered it, but they long for it.
The Relevant Source Text (Zoroastrianism)
The Arda Viraf Namak (Pahlavi Text):
Describes Hamistagan, a place for those whose good deeds and sins are perfectly equal. It is a neutral "middle ground" where souls wait in a state of neither torment nor bliss.
The concept of Al-A'raf (The Heights) as a "limbo" between Heaven and Hell has no basis in the Bible but bears a striking resemblance to the Zoroastrian Hamistagan.
This suggests the Quranic afterlife was influenced by the Persian religious concepts circulating in the Arabian Peninsula through trade and cultural contact.