The main control goal in batch process is to get a high yield of products. In this paper, to maximize the yield of 1,3-propanediol (1,3-PD) in bioconversion of glycerol to 1,3-PD, we consider an optimal control problem involving a nonlinear time-delay system. The control variables in this problem include the initial concentrations of biomass and glycerol and the terminal time of the batch process. By a time-scaling transformation, we transcribe the optimal control problem into a new one with fixed terminal time, which yields a new nonlinear system with variable time-delay. The gradients of the cost and constraint functionals with respect to the control variables are derived using the costate method. Then, a gradient-based optimization method is developed to solve the optimal control problem. Numerical results show that the yield of 1,3-PD at the terminal time is increased considerably compared with the experimental data.