In 1640, Musashi officially became the retainer of Hosokawa Tadatoshi, Lord of Kumamoto, and received seventeen loyal retainers at his service and Chiba Castle as his residence.
During the following year, 1641, Musashi wrote the "Hyoho Sanju Go", or "The Thirty-five Instructions on Strategy" for Hosokawa Tadatoshi.
This was a book dedicated to his fighting philosophy and technique, and it would form the basis of his masterpiece, the "Go Rin No Sho", which would come into being two years later.
In 1642, Musashi suffered attacks of neuralgia, a painful disorder of the nerves. Feeling that his end was near, in 1643, Musashi retired to a cave named Reigando near Kumamoto to write his "Go Rin No Sho", or "The Book of Five Rings". He finished it in the second month of 1645 and gave it to his closest student.
On the twelfth day of the fifth month, he finished writing 'Dokkodo', or "The Way of Walking Alone", a book on self-discipline, which was intended as a guide to future generations.
He died in Reigando cave on around the nineteenth day of the fifth month, possibly on June 13, 1645.