In 1768, while serving in New Orleans as governor of Spanish Louisiana, Ulloa married a woman from the high society of Lima, Francisca Melchora Rosa Ramírez de Laredo y Encalada, daughter of the Count of San Javier y Casa Laredo.  The couple had six children, among them Francisco Javier de Ulloa who became the Spanish Minister of Marine and the 22nd Captain general of the Navy.
In 1779, Ulloa was promoted to teniente general de la Armada (i.e., vice-admiral). In that same year he participated in the Great Siege of Gibraltar, but failure to prevent the first British relief of Gibraltar led to charges of dereliction of duty against Ulloa and two captains under his command, Pedro de Leyba and Manuel Núñez Gaona.  The drawn-out military justice proceedings ended with Ulloa's acquittal.  Ulloa was later appointed as chief of operations of the Spanish Navy, a position that he occupied at the time of his death in 1795.