A precise and rapid adjustment of fluxes through metabolic pathways is crucial for organisms to prevail in changing environmental conditions. Based on this reasoning, many guiding principles that govern the evolution of metabolic networks and their regulation have been uncovered. To this end, methods from dynamic optimization are ideally suited since they allow to uncover optimality principles behind the regulation of metabolic networks. We used dynamic optimization to investigate the influence of toxic intermediates in connection with the efficiency of enzymes on the regulation of a linear metabolic pathway. Our results predict that transcriptional regulation favors the control of highly efficient enzymes with less toxic upstream intermediates to reduce accumulation of toxic downstream intermediates. We show that the derived optimality principles hold by the analysis of the interplay between intermediate toxicity and pathway regulation in the metabolic pathways of over 5000 sequenced prokaryotes. Moreover, using the lipopolysaccharide biosynthesis in Escherichia coli as an example, we show how knowledge about the relation of regulation, kinetic efficiency and intermediate toxicity can be used to identify drug targets, which control endogenous toxic metabolites and prevent microbial growth. Beyond prokaryotes, we discuss the potential of our findings for the development of antifungal drugs.