The history of Sochaczew dates back to a settlement founded in the Early Middle Ages near a defensive stronghold relocated in the 14th century to a hill currently known as the Castle Mountain, where a brick castle was erected. Sochaczew was first mentioned in documents from 1138 as an alleged place of the death of Duke Bolesław III Krzywousty.

In 1221, Sochaczew was referred to as the seat of a castellany. In 1257, three churches were constructed there: parish, monastery and Dominican ones. The stronghold and settlement were destroyed following the invasion of the Lithuanians and Ruthenians in 1283. They were rebuilt and strengthened by Ziemowit III, Duke of Mazowsze. At the end of the 13th or at the beginning of the 14th century (most probably in 1324), Sochaczew was granted municipal rights. In 1377, Siemowit III wrote down and proclaimed the laws of Mazowsze in Sochaczew. At that time, the town functioned as the capital of the Sochaczew Land and its dukes were vassals of the Polish king.

In 1476, the Sochaczew Land was annexed by the Kingdom of Poland as part of the Rawa Province and Sochaczew itself became a royal city. In 1434 and 1476, its municipal rights were confirmed. Despite the fires that wreaked havoc in the town in 1506, 1509, 1536 and 1590, Sochaczew had a large population. In 1564, about 2 thousand people lived in 330 houses, mainly artisans affiliated in 22 guilds. Before 1630, the old castle was turned into the seat of starostes. In 1619, another fire destroyed half of the town. Sochaczew was also ruined by the wars in the second half of the 17th century, particularly the Swedish Deluge. In 1660, only 13 houses remained in the town. Several dozen years later, Sochacze had only slightly over 200 inhabitants.  Further destruction was brought by the wars at the beginning of the 18th century and an epidemic in the years 1708–1709.

In the second half of the 18th century, the town was gradually gaining in importance. The number of inhabitants grew to about 1500. Following the third partition of Poland (1795), the Sochaczew Land came under Prussian occupation (South Prussia). In 1807, it became part of the Duchy of Warsaw (Warsaw department) and was incorporated in 1815 into the Kingdom of Poland (Province, later Governorate of Warsaw). At the beginning of the 19th century, the urban layout of Sochaczew underwent changes and first industrial plants were established. In the 1860s the splendid growth of the town came to a halt. It was only after a railway line connecting Sochaczew to Warsaw, Łowicz and Łódź was launched in 1903 that the first signs of recovery appeared.

Sochaczew was again partially destroyed in the wake of the First World War. After the war, the town (the seat of a poviat in the Warsaw Province) was rebuilt. It became the home of several new factories: those manufacturing rayon, gun cotton and gunpowder. During the Second World War, the poviat was part of the Warsaw district of the General Government. It was a site of the activity of the Armed Resistance and later the Home Army. About 40% of buildings in the town were destroyed during the hostilities.

After the war, the newly-rebuilt city became a centre of the chemical, mechanical and food industries. The Sochaczew poviat was part of the Warsaw Province until 1975 and of the Skierniewice Province in the years 1975-1998. It was incorporated into the Mazovia Province in 1999.  

In 1977 the neighbouring town of Chodaków was incorporated into Sochaczew. In 2013, the town was inhabited by about 37 thousand people.