The Pahlavi script was used to record the Pahlavi or Middle Persian language that was spoken in pre-Islamic Iran between 3rd century BCE and 9th century CE. Pahlavi evolved from the Aramaic, and so it retained the right-to-left writing direction. However, the Aramaic script was suited to write a Semitic language, and therefore introduced difficulties in representing the Persian language. One problem was that Middle Persian had more consonants then Aramaic, and the solution to which was to use some of the letters to represent multiple sounds. Another difficulty was to need to represent vowels. In this case, the old Aramaic letters of 'aleph was used to write the vowel /a/. A more complicated scenario involved the letters yod, which was used to write the semi-vowel /y/ as well as the vowels /i/ and /e/. Similarly, the Aramaic letter waw was used for /w/, /u/, /o/, and sometimes the consonant /v/.
There were several forms of Pahlavi as it evolved through time. The most notable variants are those from the Arsacid (256 BCE to 226 CE) and the Sassanian (226 to 652 CE) dynasties, which might had actually represented slightly different dialects. Also, a more cursive variant was also used for writing on papers and manuscripts. Unfortunately, many letters in the cursive script grew to be visually similar (if not identical), making the script even more complicated.
The manuscript variant of Pahlavi is illustrated in the following chart.
The Pahlavi script was used extensively to write new Zoroastrian religious texts as well as translate existing Avestan scriptures as well. It also became the base model for a script to write the previously unwritten Avestan language.
One interesting fact about Pahlavi is that it had many Aramaic loanwords that were spelled as if they were in Aramaic but pronounced in Pahlavi. These loans are called xenographs, and represent a long traditional of "visual" borrowing that date back to Akkadian and Babylonian periods.
The Sassanian dynasty ended in 652 CE in the wake of the Islamic conquest of Persia. The Pahlavi script continued to be written for the next 300 years, but it was slowly phased out by an Arabic-derived alphabet modified for Persian.