The precise tuning of gene expression levels is essential for optimal performance of transcriptional regulatory networks. Many regulatory components control promoter output, but transcription factor (TF) binding sites are amongst the most prominent. Besides TF binding site affinity, one needs to consider the context (number, location, orientation and accessibility) of the sites to fully understand its role in gene regulation. To better understand how binding site affinity and context determine regulatory activity, we created a library of 209 variants of the budding yeast Saccharomyces cerevisiae PHO5 promoter to quantitate how different binding sites for the TF Pho4 affect its output. We developed a robust, rapid and high-fidelity synthesis and transformation protocol to create the promoter library. Each promoter was assembled by high-temperature ligation, cloned into plasmids by isothermal assembly, maintained in E. coli, and consequently transformed into yeast by homologous recombination. Synthesis errors occurred at frequencies comparable to, or lower than those achieved with current gene synthesis methods. The library's induction on limitation or starvation of inorganic phosphate (Pi) was studied in bulk and at the single-cell level at seven different Pi concentrations on a high-throughput microfluidic device containing 1152 microchemostats. We found that in vivo TF binding site affinity is a primary determinant of promoter activity and that TF binding affinities determined in vitro could quantitatively predict the output of a complex yeast promoter. We developed a statistical mechanical model based on TF-DNA binding and inter-TF competition that predicted 95% of the output of our library. Promoter output was precisely tunable by changes in TF binding site affinity less than 3 kcal/mol, accessible by modifying 1-2 bases. We mapped the output of the promoter library as a function Pi concentration and found that the wild-type PHO5 promoter is precisely tuned to maximize output under fully inducing conditions while preventing promoter activation at intermediate Pi concentrations. Our results provide insights into how TF binding sites regulate gene expression, their possible evolution, and how TF binding site affinities can be used to precisely tune gene expression. More generally, we show that quantitative in vitro TF binding energy landscapes can precisely predict the output of a native yeast promoter, indicating that quantitative models of transcriptional regulatory networks are feasible.