Portuguese kings used it as a residence almost without a break, from the early 15th century or earlier until near the end of the 19th, and the building is now a historic house museum within the Cultural Landscape of Sintra, a UNESCO World Heritage Site. Its rooms mix Gothic, Manueline, Moorish and Mudéjar styles, most of which comes from two great rounds of building, one in the 15th century and one in the early 16th.

The site goes back to Moorish rule, when it was one of two castles at Sintra and the seat of the rulers of the Taifa of Lisbon; the other is the Castelo dos Mouros on the hill above. King Afonso Henriques took it over after conquering the village in the 12th century, but nothing from the Moorish period or the first Portuguese kings survives. The oldest part still standing is the Royal Chapel, which may go back to King Dinis I and the first decades of the 14th century, with a tiled floor laid like a carpet in the apse, walls painted with a dove for the Holy Ghost, and a wooden ceiling in geometric Moorish latticework.

Much of what visitors see dates from a campaign begun around 1415 by John I, who built the wing around the central courtyard, the façade with its entrance arches and the paired Manueline and Moorish windows known as biforas. Two of his rooms are known for their ceilings. The Swan Room has thirty painted swans, one for each year of Infanta Isabel's age at her marriage to Philip the Good of Burgundy, whose house used the swan as its emblem. The Magpie Room is covered with magpies holding the motto por bem in their beaks; the story goes that the king, caught kissing a lady-in-waiting by Queen Philippa of Lancaster, had one painted for every woman at court to put an end to the gossip. The early wing also has tiled patios with Islamic-style pools, and in the Arab Room a Moorish fountain stands at the centre of a tiled floor.

Manuel I reshaped the palace between 1497 and 1530 with the riches of the Age of Discoveries. He added the Manueline Wing to the right of the façade and lined many rooms with multicoloured tiles made for him in Seville, decorated with Mudéjar motifs. His Coat of Arms Room, built in 1515–1518, is the high point of the visit: a domed wooden ceiling painted with 72 heraldic shields, the king's own among those of Portugal's great noble houses, from which the arms of the Távora family were later taken down once the family had plotted against King Joseph I. The two great kitchens, each with a wall of ovens and stoves beneath its tapering chimney, also belong to the route.

Later kings kept using the palace. The deposed Afonso VI was confined here by his brother Peter II from 1676 until his death in 1683, and the 1755 earthquake brought down the tower above the Arab Room. Queen Amélie of Orléans, who made several drawings of the building, was among its 19th-century admirers. The palace became a national monument after the Republic was founded in 1910, and in the 1940s the architect Raul Lino restored its tile panels and furnished it with old pieces brought from other palaces.