He was educated in Rome and received a doctorate in philosophy. On 16 December 1641, the day his uncle became a cardinal, Raggi was appointed a cleric of the Apostolic Chamber. He later became that body's treasurer-general. He was appointed Commissary of the papal troops during the Wars of Castro and Intendant-General of the galleys of the Papal State.
At times when Cardinal Fausto Poli was not in Rome, Raggi acted at Majordomo of the papal household. Some historians have suggested that Urban intended to elevate Raggi to the cardinalate but was unable to prior to his illness and subsequent death in 1644.
In 1646, as treasurer of the Apostolic Chamber, Raggi ushered-in major changes to the way fees were calculated and collected, reforming processes that had been the subject of concern during Urban's reign and increasing accountability.
Raggi was finally elevated to cardinal by Pope Innocent X on 7 October 1647 and was appointed cardinal-deacon of S. Maria in Domnica in December of that year. He acted temporarily as Camerlengo of the Holy Roman Church in 1650 during the absence of Cardinal Antonio Barberini. In 1653, he cardinal-deacon of Sant'Angelo in Pescheria. At the death of Innocent X in 1655, Raggi participated in the papal conclave that elected Pope Alexander VII.
Raggi became cardinal-deacon of Sant'Eustachio in 1660 and then cardinal-priest of Santi Quirico e Giulietta in 1664. In that same year he was appointed Cardinal-protector of Sicily, a position he held until his death.
He took part in the papal conclave of 1667 which elected Pope Clement IX, the conclave of 1669-70 which elected Pope Clement X the conclave of 1676 which elected Pope Innocent XI. He became cardinal-priest of San Lorenzo in Damaso 1679.
Twice he was offered archbishoprics by King Felipe IV of Spain, first Salerno and Taranto, but refused both. Instead he served as Legate in Romagna. Eventually he opted for a suburbicarian see and became Bishop of Palestrina in January 1680 and was consecrated only days later on 14 January by Cardinal Alderano Cybo.