Under Rama I (1782–1809), Rattanakosin successfully defended against Burmese attacks and put an end to Burmese incursions. He also created suzerainty over large portions of Laos and Cambodia.[38] In 1821, Briton John Crawfurd was sent to negotiate a new trade agreement with Siam – the first sign of an issue which was to dominate 19th century Siamese politics.[39] Bangkok signed the Burney Treaty in 1826, after the British victory in the First Anglo-Burmese War.[33]: 281 Anouvong of Vientiane, who mistakenly held the belief that Britain was about to launch an invasion of Bangkok, started the Lao rebellion in 1826 which was suppressed.[33]: 283–5 Vientiane was destroyed and a large number of Lao people were relocated to Khorat Plateau as a result.[33]: 285–6 Bangkok also waged several wars with Vietnam, where Siam successfully regained hegemony over Cambodia.[33]: 290–2
From the late-19th century, Siam tried to rule the ethnic groups in the realm as colonies.[33]: 308 In the reign of Mongkut (1851–1868), who recognised the potential threat Western powers posed to Siam, his court contacted the British government directly to defuse tensions.[33]: 311 A British mission led by Sir John Bowring, Governor of Hong Kong, led to the signing of the Bowring Treaty, the first of many unequal treaties with Western countries. This, however, brought trade and economic development to Siam.[40] The unexpected death of Mongkut from malaria led to the reign of underage Prince Chulalongkorn, with Somdet Chaophraya Sri Suriwongse (Chuang Bunnag) acting as regent.[33]: 327
Chulalongkorn (r. 1868–1910) initiated centralisation, set up a privy council, and abolished slavery and the corvée system. The Front Palace crisis of 1874 stalled attempts at further reforms.[33]: 331–3 In the 1870s and 1880s, he incorporated the protectorates up north into the kingdom proper, which later expanded to the protectorates in the northeast and the south.[33]: 334–5 He established twelve krom in 1888, which were equivalent to present-day ministries.[33]: 347 The crisis of 1893 erupted, caused by French demands for Laotian territory east of Mekong.[33]: 350–3 Thailand is the only Southeast Asian nation never to have been colonised by a Western power,[41] in part because Britain and France agreed in 1896 to make the Chao Phraya valley a buffer state.[42] Not until the 20th century could Siam renegotiate every unequal treaty dating from the Bowring Treaty, including extraterritoriality. The advent of the monthon system marked the creation of the modern Thai nation-state.[33]: 362–3 In 1905, there were unsuccessful rebellions in the ancient Patani area, Ubon Ratchathani, and Phrae in opposition to an attempt to blunt the power of local lords.[33]: 371–3
The Palace Revolt of 1912 was a failed attempt by Western-educated military officers to overthrow the Siamese monarchy.[33]: 397 Vajiravudh (r. 1910–1925) responded by propaganda for the entirety of his reign,[33]: 402 which promoted the idea of the Thai nation.[33]: 404 In 1917, Siam joined the First World War on the side of the Allies.[33]: 407 In the aftermath Siam had a seat at the Paris Peace Conference, and gained freedom of taxation and the revocation of extraterritoriality.[33]: 408