Graves from the Hallstatt era and La Tene era (325-250 BC) as well as other traces from the Bronze Age were discovered in Epagny. The remains of a Roman era villa from the 2nd-3rd century AD and an Early Middle Ages cemetery were also found nearby. A Roman settlement was probably located on a hill in Gruyères.
On June 22, 1476, Gruyères participated in the Battle of Morat against the Charles the Bold, Duke of Burgundy. With the help of the Old Swiss Confederacy, they routed the Burgundian army and captured three capes of the [Order of the Golden Fleece] which belonged to Charles the Bold including one with the emblems of Philip the Good, his father. At the time of the battle he was celebrating the anniversary of the death of his father.
The town church of Gruyères originally belonged to the parish of Bulle. Count Rudolph III allowed the villages on the left bank of the Saane to built St. Theodul's church. When it was dedicated in 1254, it was the parish church of the new Gruyères parish. The Counts of Gruyères were buried under the altar of St. Michael in the church. It was mostly destroyed in 1670 and again in 1856 by fire, which only left the choir and tower undamaged. The renovated church was consecrated in 1860. In addition to the parish church, the Counts had the Chapel of St. John the Baptist in the castle, with two glass windows dating from the late 15th century. The Chapel of St. Moritz in the old hospital was built with the hospital in 1431. The Chapelle du Berceau was built in 1612, following a plague that killed 140.
During the Thirty Years' War, nuns from St. Bernard and the Visitation Order fled from Besançon und Dole to settle in Gruyères. The latter remained in town between 1639 and 1651 and conducted a private school. Starting in the 15th century a primary school opened in town which was open mainly to boys. A secondary school opened in town in the 20th century but it moved in 1973 to Bulle. Gruyères had a plague house which was first mentioned in 1341. The town's hospital was founded in the mid-15th century and remained in operation until the second half of the 19th century. One side of the hospital building housed the primary school until 1988 and was then renovated into a nursing home. Between 1891 and 1925 the Ingenbohl sisters ran the Deaf and Dumb Institute of Saint-Joseph in Gruyères. In 1925 it moved to Fribourg.
Nineteen counts are accounted for in the period between the 11th and 16th centuries. The last of them, Michel, had been in financial trouble almost all his life only to end in bankruptcy in 1554. His creditors the cantons of Fribourg and Bern shared his earldom between them. From 1555 to 1798 the castle became residence to the bailiffs and then to the prefects sent by Fribourg. In 1849 the castle was put up for sale and sold to the Bovy and Balland families, who stayed at the castle during summer time and restored it with the help of their painter friends. The castle was then bought back by the canton of Fribourg in 1938, made into a museum and opened to the public. Since 1993, a foundation ensures the conservation as well as the highlighting of the building and the collection.