Bott–Samelson varieties are an important tool in geometric representation theory [1, 3, 10, 25]. They were originally defined as desingularizations of Schubert varieties and share many of the properties of Schubert varieties. They have an action of a Borel subgroup, and the projective coordinate ring of a Bott–Samelson variety splits into certain generalized Demazure modules (which also appear in other contexts [22, 23]). Standard Monomial Theory, developed by Seshadri and the first author [15, 16], and recently completed by the second author [20], gives explicit bases for the Demazure modules associated to Schubert varieties. In this paper, we extend the techniques of [20] to give explicit bases for the generalized Demazure modules associated to Bott–Samelson varieties, thus proving a strengthened form of the results announced by the first and third authors in [12] (see also [13]). We also obtain more elementary proofs of the cohomology vanishing theorems of Kumar [10] and Mathieu [25]; of the projective normality of Bott–Samelson varieties; and of the Demazure character formula.