Nothing is known so far about the family and the musical education of Lonati, but he is thought to have been born in Milan. Between 1665 and 1667 he figured as a violinist in the viceroy's (Pedro Antonio de Aragón) chapel in Naples.
Since 1673 he was in the service of Queen Christina of Sweden, and led her string orchestra, and from that time was also known as the "Queen's Hunchback" ('Il Gobbo della Regina'). He made friends with Alessandro Stradella, his companion in notoriety. Together with Carlo Mannelli and Lelio Colista he counted among the "più valorosi professori musici di Roma". From this period probably dates the majority of his compositions for several instruments.
The Teatro Tordinona, the first public theater for opera performances in Rome, opened in 1671 with music by Bernardo Pasquini. In 1673 he sang in Pasquini's L'Amor per vendetta. Lonati played the comic character Vafrindo, singing and playing the violin on stage. The dual roles as a singer of funny songs and virtuoso performer on stage is considered his specialty. He was appointed as a violin player at the Oratory of Santissimo Crocifisso. Due to the closure of the Tordinona theatre from the Holy Year 1675, it is suggested that Lonati left Rome and participated in two Venetian works of Giovanni Legrenzi.
Lonati also worked in Genoa, from autumn 1677 to carnival of 1678, as the impresario of the Falconi theater. In Genoa, Lonati was joined by Stradella. After the stabbing of Stradella, Lonati left the city. (This period could be in the Royal Chapel of Madrid.)
In 1684 Lonati appears as a virtuoso in the service of Ferdinando Carlo Gonzaga, Duke of Mantua. Lonati composed his only oratorio for the court at Modena. During the 1680s he worked at the Mantuan court, then spent his last years in Milan where five of his ten known operas were performed.
Lonati was present in London during the reign of James II of England, in the company of the famous singer Giovanni Francesco Grossi, who would serve the Queen of England, Maria Beatrice d'Este. The stay in London is placed between the end of 1686 and 1688.
In 1691 the name of Lonati is still in the list of musicians employed at the court of Mantua. At that time, Lonati is increasingly present in the musical life in Milan.
Despite the lack of proof, the violinist Francesco Geminiani continues to be regarded as a student of Lonati.
It is not known if Lonati visited the court of Emperor Leopold I, to whom he dedicated his last work, a set of twelve sonatas for violin and basso continuo. The 12 sonatas are considered his best composition due to their technical difficulties and expressive range.
Lonati's few extant violin works reveal a bold, fluent style with (in his 1701 12 Sonate per violino e basso continuo) prominent double stopping and use of scordatura, as well as the idiosyncratic melodic writing that runs through all his music. His cantatas – long, varied and of unusual expressive force – rank with those of Stradella and Alessandro Scarlatti, while his surviving operas, in Venetian style, are characterized by mature da capo arias and a penchant for the stile concitato with brilliant writing for obbligato instruments.
Lonati had his work seldom printed, so it could not be copied by people that could "hardly read a watch".Amor stravagante (Libretto by Giovanni Filippo Apolloni Amor per vendetta o vero L'Alcasta), 1677 Genua, Teatro Falcone
Amor per destino (Libretto by Nicolò Minatos Antioco), 1678 Genua
Ariberto e Flavio, regi de Longobardi (Libretto by Rinaldo Cialli), 9. Dez. 1684 Venice, Teatro S. Salvatore.
Enea in Italia (Giacomo Francesco Bussani), 1686 Milano, Regio Teatro Nuovo
I due germani rivali, 1686 Modena, Teatro Fontanelli
Scipione africano (Libretto by Nicolò Minato), 1692 Milano, Regio Teatro; together with Paolo Magni
L'Aiace (Libretto by Pietro d'Averara), 1694 Milano, Regio Teatro; together with Paolo Magni and Francesco Ballarotti