“Ordinarily during my childhood I was always involved in spiritual exercises. Only occasionally did we have a few days’ break between two forty-day periods of spiritual retreat and fasting. During one of those periods of spiritual retreat, Sufi Sultan, the guardian of Sultan Ishaq’s shrine, brought me two strings of delicious dried figs. I set them aside specially for myself, and each night I broke my fast in a state of intense desire for those figs; after breaking the fast, I would take great pleasure in eating a few of them, until the forty days were over. On the last night of the retreat I had a dream in which I saw each person’s spiritual exercises being recorded. I saw my own as a wall that I had built with beautiful bricks, except that a corner of each brick was broken off and incomplete. Someone said to me: ‘Because your mind was busy with those figs, your love of figs made those corners incomplete.’
The next day my mother, as she usually did, asked my father’s permission to prepare an offering meal [to mark the end of the retreat]. ‘No,’ my father replied, ‘because this person’s spiritual exercise is imperfect, he’ll have to perform another forty days of fasting and retreat, as a fine, so that his mind won’t be filled with figs.’
The point of this is that the essential condition for spiritual exercise and fasting is not just doing without food. Rather, the spiritual traveler must always have his attention on the Source and cut his attachments to everything else. Otherwise there are plenty of people who go without eating something. So the general condition for spiritual exercise is to have your attention continually on the divine Source.” 
The source of this story is Ustad Ilahi (1895-1974) whose father, Hajj Ni’matullah Jayhunabadi, known as Hajji Ni’mat, was also his spiritual master until he was 21.
They lived in Iran (formerly Persia).
In Islam, fasting — during Ramadan, for example — is done during daylight hours, before or after which one may eat.
“40 days” of fasting is reminiscent of Mosheh’s 40 days of fasting on Mt. Sinai, preparing to receive the Divine revelation of the 10 Commandments. 
During that time, he was utterly dependent on G-d to preserve his life. At the same time, he was in a state of complete receptivity.
All these could be seen as themes underlying fasting on Yom Kippur.
Ustad’s lesson — fasting is meant to limit distractions and help keep our attention on our Divine Source — is therefore clearly very relevant to Yom Kippur.
[note: I prepared and scheduled this post several weeks before the outbreaks of violence beginning on Sept. 11, 2012. After they began, I wondered whether the context had shifted so much as to obscure my purpose in offering it. I considered replacing it, but decided to keep it. I fundamentally believe that there’s great value in every religion, even if actions done by people in the “name” of their religion cause us to question it deeply.]
 (illustration from) Rumi Online: Western Encounters with Persian Sufi Literature; colors inverted; (see) sologak1.blogspot.com
 Renard, John, ed.; Tales of G-d’s Friends; Univ. of California Press, © 2009; p. 106
 Sh’mot/Exodus 24:18 and 34:28; Qur’an — 7:142 (Surah “A’raf” — “The Heights”).
For more on the significance of “40” in Islam, see: http://themuslimvoice.wordpress.com/2009/04/22/why-is-the-number-40-important-in-islam/