Khalīl Allāh II ʿAlī (Arabic: خليل الله الثاني علي) was the 39th imam of the Qasim-Shahi branch of the Nizari Isma'ili community.
Khalil Allah II Ali succeeded his father Nur al-Dahr Ali when the latter died in 1671, until his own death in January 1680. He was buried in a tomb in the mausoleum of his predecessor, al-Mustansir Billah III. Khalil Allah II Ali was the last Nizari imam to reside in Anjudan; his successor Shah Nizar II moved his residence to the nearby village of Kahak.