The last great king (Shah) of the Sasanian Empire, which was the last Iranian empire before Islam, was ambitious. He conquered many of the Roman provinces in the Middle East, and greatly expanded the Empire.
That expansion, alas, did not last. Overstretched and following a series of defeats, the territories gains were undone. Eventually his son deposed him and seized power.
Five years later, Muslim conquest of Iran began.
Khosrow II was the last king of Iran to have a lengthy reign before the Muslim conquest of Iran, which began five years after his execution. He lost his throne, then recovered it with Roman help, and, a decade later, went on to emulate the feats of the Achaemenids, conquering the rich Roman provinces of the Middle East; much of his reign was spent in wars with the Byzantine Empire and struggling against usurpers such as Bahram Chobin and Vistahm.
During the climactic Byzantine–Sasanian War of 602–628, Khosrow expanded deep into western Asia Minor, eventually besieging the Byzantine capital of Constantinople in 626 alongside Avar and Slavic allies. Following the failure of the siege, Heraclius started a counterattack, undoing all territorial gains by Khosrow in the Levant, most of Anatolia, the western Caucasus, and Egypt, eventually marching into the Sassanian capital of Ctesiphon. The Byzantines also regained the True Cross, which Khosrow had captured following his conquest of the Levant during the same 602–628 war.