Owing to its applicability in sustainable engineering, flow electrochemical synthesis in a proton-exchange membrane (PEM) reactor has attracted considerable attention. Because the reactions in PEM reactors are performed under electro-organic and flow-synthetic conditions, a higher number of reaction parameters exist compared to ordinary reactions. Thus, the optimization of such reactions requires significant amounts of energy, time, chemical and human resources. Herein, we show that the optimization of alkyne semihydrogenation in PEM reactors can be facilitated by means of Bayesian optimization, an applied mathematics strategy. Applying the optimized conditions, we also demonstrate the generation of a deuterated Z-alkene.