Thus have I heard. At one time, The Buddha was abiding in the Icchānaṅgala Forest.
At that time, the Bhagavān said to the bhikṣus, “I wish to sit in dhyāna for two months. The bhikṣus should not come and go here, except for a bhikṣu to deliver food, and at the time of the Upavasatha. At that time, after the Bhagavān had said this, he then sat in dhyāna for two months. There were no bhikṣus who disturbed him, except to deliver food, and at the time of the Upavasatha.
At that time, after the Bhagavān’s two months of sitting in dhyāna had passed, he awoke from dhyāna. With the bhikṣu saṃgha seated before him, he said to the bhikṣus, “Suppose those on outer paths, who have left home, were to question you, ‘What seated dhyāna was Śramaṇa Gautama in for those two months?’ You should reply, “For two months, the Tathāgata was abiding in the contemplation of sitting in dhyāna with ānāpānasmṛti.” For what reason? In these two months, I was mindful of ānāpāna, abiding a long time in contemplation, When there was an in-breath, I was mindful of the in-breath, knowing it as it really was; when there was an out-breath, I was mindful of the out-breath, knowing it as it really was; whether long or short. Aware of the entire body, I was mindful of the in-breath, knowing it as it really was; aware of the entire body, I was mindful of the out-breath, knowing it as it really was. Calming bodily formations, I was mindful of the in-breath, knowing it as it really is... even up to contemplating cessation, mindful of the out-breath, knowing it as it really is. In all cases I knew them. At that time, I thought, “This abiding in contemplation is still coarse. I will now bring this contemplation to rest, and then cultivate an even more subtle state, and cultivate abiding in that.
“At that time, I calmed that coarse contemplation, and then entered a more subtle contemplation, and abided there a long time. Then there were three devaputras from the highest realm of form who came in the night to the place where I was. One devaputra said these words: ‘Śramaṇa Gautama has arrived.’ Another devaputra said, ‘He has not arrived, he is arriving.’ The third devaputra said, ‘He has neither arrived, nor is he arriving. This abiding in cultivation is the cessation of an arhat.’”
The Buddha said to the bhikṣus, “If there is that which may be correctly said to be the noble abiding, the divine abiding, the pure abiding, the abiding of training, the abiding of beyond training, the abiding of the Tathāgata, that those trainees who have not obtained it should obtain it; those who have not arrived at it should arrive at it; those who have not realized it should realize it; that present abiding in the bliss of the Dharma, for those beyond training, is, ‘ānāpānasmṛti,’ and may be correctly said to be this. For what reason? Ānāpānasmṛti is the noble abiding, the divine abiding, the pure abiding... up to... that present abiding in the bliss of the Dharma, for those beyond training.”After the Buddha had spoken this sūtra, the bhikṣus heard what the Buddha had said, and joyfully practiced in accordance.