The Buddha could live for an aeon due to his mastery of the four bases of psychic ability, but Ananda is unable to comprehend and the Buddha then gives up the life force at the Cāpāla Shrine.

Cetiya sutta - Shrine

Thus have I heard - At one time, the Blessed One was dwelling in Vesāli, in the Great Forest, in the hall with a peaked roof. Then, in the morning, the Blessed One dressed, took his bowl and robe, and entered Vesāli for alms. After going on almsround in Vesāli and returning from his almsround after his meal, the Blessed One addressed Venerable Ānanda: "Take your sitting mat, Ānanda. We shall go to the Cāpāla Shrine for the day's abiding."

"Yes, venerable sir," Venerable Ānanda replied to the Blessed One, and taking his sitting mat, followed closely behind the Blessed One.

Then the Blessed One went to the Cāpāla Shrine and, upon arrival, sat down on the prepared seat. Venerable Ānanda paid homage to the Blessed One and sat down to one side. While seated to one side, the Blessed One addressed Venerable Ānanda:

"Vesāli is pleasing, Ānanda, Udena Shrine is pleasing, Gotamaka Shrine is pleasing, Sattamba Shrine is pleasing, Bahuputta Shrine is pleasing, Sārandada Shrine is pleasing, and Cāpāla Shrine is pleasing. Ānanda, whoever has developed and frequently practiced the four bases of psychic ability, mastered them, firmly established them, repeatedly practiced them, consolidated them, and resolutely undertaken them, could, if they so wished, live for an aeon or the remainder of an aeon. The Tathāgata, Ānanda, has developed and frequently practiced these four bases of psychic ability, mastered them, firmly established them, repeatedly practiced them, consolidated them, and resolutely undertaken them. If he so wished, Ānanda, the Tathāgata could live for an aeon or the remainder of an aeon."

Even so, while the Blessed One was giving such a clear and evident sign, venerable Ānanda was unable to comprehend and did not beg the Blessed One, saying, 'May the Blessed One remain for an aeon, may the Blessed One remain for the benefit and happiness of the many, out of compassion for the world, for the benefit, welfare, and happiness of gods and humans,' because his mind was overwhelmed by Māra.

A second time, the Blessed One ... A third time, the Blessed One addressed Venerable Ānanda:

"Vesāli is pleasing, Ānanda, Udena Shrine is pleasing, Gotamaka Shrine is pleasing, Sattamba Shrine is pleasing, Bahuputta Shrine is pleasing, Sārandada Shrine is pleasing, and Cāpāla Shrine is pleasing. Ānanda, whoever has developed and frequently practiced the four bases of psychic ability, mastered them, firmly established them, repeatedly practiced them, consolidated them, and resolutely undertaken them, could, if they so wished, live for an aeon or the remainder of an aeon. The Tathāgata, Ānanda, has developed and frequently practiced these four bases of psychic ability, mastered them, firmly established them, repeatedly practiced them, consolidated them, and resolutely undertaken them. If he so wished, Ānanda, the Tathāgata could live for an aeon or the remainder of an aeon."

Even so, while the Blessed One was giving such a clear and evident sign, venerable Ānanda was unable to comprehend and did not beg the Blessed One, saying, 'May the Blessed One remain for an aeon, may the Blessed One remain for the benefit and happiness of the many, out of compassion for the world, for the benefit, welfare, and happiness of gods and humans,' to such an extend was his mind overwhelmed by Māra.

Then the Blessed One said to Venerable Ānanda: "Go now, Ānanda, and do what you consider appropriate at this time."

"Yes, venerable sir," Venerable Ānanda replied to the Blessed One, and after paying homage to the Blessed One, and circumambulating him, he sat down under a nearby tree.

Then Māra the Evil One, shortly after Venerable Ānanda had left, approached the Blessed One and said:

"Let the Blessed One now attain final Nibbāna, let the Blessed One now attain final Nibbāna. Now is the time for the Blessed One's final Nibbāna. Venerable sir, the Blessed One has said: 'I will not attain final Nibbāna until my bhikkhus are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining it, teaching it, declaring it, establishing it, disclosing it, analyzing it, and explaining it, until the Dhamma has been well proclaimed among gods and humans.'

Now, venerable sir, there are bhikkhus who are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining them, teaching them, declaring them, establishing them, disclosing them, analyzing them, and explaining them. Let the Fortunate One now attain final Nibbāna, let the Blessed One now attain final Nibbāna. Now is the time for the Blessed One's final Nibbāna.

The Blessed One has also said: 'I will not attain final Nibbāna until my bhikkhunis are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining it, teaching it, declaring it, establishing it, disclosing it, analyzing it, and explaining it, until the Dhamma has been well proclaimed among gods and humans.'

Now, venerable sir, there are bhikkhunis who are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining it, teaching it, declaring it, establishing it, disclosing it, analyzing it, and explaining it. Let the Fortunate One now attain final Nibbāna, let the Blessed One now attain final Nibbāna. Now is the time for the Blessed One's final Nibbāna.

The Blessed One has also said: 'I will not attain final Nibbāna until my male lay followers ... female lay followers are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining it, teaching it, declaring it, establishing it, disclosing it, analyzing it, and explaining it, until the Dhamma has been well proclaimed among gods and humans.'

Now, venerable sir, there are male lay followers ... female lay followers who are established as distinguished in learning, trained, confident, very learned in the Dhamma, practicing the Dhamma in accordance with the Dhamma, practicing rightly, conducting themselves properly, living according to the Dhamma, explaining it, teaching it, declaring it, establishing it, disclosing it, analyzing it, and explaining it. Let the Fortunate One now attain final Nibbāna, let the Blessed One now attain final Nibbāna. Now is the time for the Blessed One's final Nibbāna.

The Blessed One has also said: 'I will not attain final Nibbāna until this spiritual life has been well-established, well-developed, widespread, well-proclaimed, and well-established among gods and humans.' Now, venerable sir, this spiritual life has been well-established, well-developed, widespread, well-proclaimed, and well-established among gods and humans. Let the Fortunate One now attain final Nibbāna, let the Blessed One now attain final Nibbāna. Now is the time for the Blessed One's final Nibbāna."

When this was said, the Blessed One addressed Māra the Evil One: "Be at ease now, Māra. The Tathāgata's final Nibbāna will not be long delayed. Three months from now, the Tathāgata will attain final Nibbāna."

Then the Blessed One, mindful and fully aware, relinquished the life force at the Cāpāla Shrine. When the Blessed One had relinquished the life force, there was a great earthquake, terrifying and hair-raising, and thunder cracked the sky. Then the Blessed One, understanding the significance of this moment, uttered this inspired utterance:

"Comparing both the comparable and the incomparable, The sage relinquished the formations of continued existence; Rejoicing within, mentally composed, He shattered the armor of self-existence."