The problem of operating a tray freeze dryer to obtain a desired final bound water content in minimum time is formulated as an optimal control problem with the use of the rigorous unsteady state mathematical model of Sadikoglu and Liapis  that has been found to describe satisfactorily the experimental dynamic behavior of the primary and secondary drying stages of bulk solution freeze drying of pharmaceuticals in trays. The heat input to the material being dried and the drying chamber pressure are considered to be control variables. Constraints are placed on the system state variables by the melting and scorch temperatures during primary drying, and by the scorch temperature during secondary drying. Necessary conditions of optimality for both the primary and secondary drying stages are derived and presented, and an approach for constructing the optimal control policies that would minimize the drying times for both the primary and secondary drying stages, is presented. The theoretical approach presented in this work was applied in the freeze drying of skim milk, and significant reductions in the drying times of primary and secondary drying were obtained, when compared with the drying times obtained using the operational policies reported in the literature, by using the optimal control policies constructed from the theory presented in this work. Furthermore, it is shown that the optimal control policy leads to the desired in practice result of having at the end of secondary drying temperature and bound water concentration profiles (in the dried layer) whose gradients are very small. It is also shown that by using the optimal control policy and an excipient capable of increasing the melting temperature without affecting product quality, one can significantly reduce the drying time of the primary drying stage.