ANSWER: No perfect answer exists regarding how the apostle John died. The Bible offers us no details regarding his demise. Information regarding his last days comes to us primarily from tradition. The 1913 Catholic Encyclopedia, in an article on St. John the Evangelist, states that writers in the second and third centuries A.D. accepted a widely held tradition that the apostle spent his last days in Ephesus.
According to the Catholics, Justin Martyr also referred to John as an apostle of Jesus who lived in Ephesus. St. Irenaes, Eusebius and still others, again according to the Catholic Encyclopedia, all agree that John left the isle of Patmos where he was banished for preaching the gospel (see Revelation 1:9). The last living apostle then spent his remaining days in Ephesus until he died somewhere around the close of the first century.
A well-known reference book on New Testament Martyrs, written by John Foxe (1515 - 1587), states that the apostle, as punishment for being a believer in Christ, was thrown into a cauldron of boiling oil.
"From Ephesus he was ordered to be sent to Rome, where it is affirmed he was cast into a cauldron of boiling oil. He escaped by miracle, without injury. Domitian afterwards banished him to the Isle of Patmos, where he wrote the Book of Revelation. Nerva, the successor of Domitian, recalled him. He was the only apostle who escaped a violent death" (Foxe's Book of Martyrs)
The Emperor Domitian reigned as Roman Emperor from 81 to 96 A.D. He likely banished John to the island of Patmos, which is near the coast of Asia Minor and the city of Ephesus, in 95 A.D. His successor, Nerva, who ruled the world empire from 96 to early 98, likely released John in 96 from his banishment to Patmos. This last living person who witnessed the transfiguration of Christ (Matthew 17:1 - 9) was likely the only one of the original twelve disciples to die a peaceful death.
Easton's Bible Dictionary writes that John 'retired' to Ephesus after writing Revelation. The aged apostle, according to Easton's, outlived just about all his friends and his many acquaintances made over the years.
In conclusion, the apostle John was exiled to Patmos in 95 A.D. It was during his stay on the island that he not only wrote the Book of Revelation but also finished writing his gospel account. After his release, he finalized the arrangement of books and the canonization of the New Testament around 96 - 99 A.D. As the last living person who was directly instructed during Jesus' earthly ministry, John lived a long life and died close to 100 A.D. Evidence suggests the last apostle ended his days in the Asia Minor city of Ephesus.