Large imaging surveys, such as the Legacy Survey of Space and Time, rely on photometric redshifts and tomographic binning for 3 × 2 pt analyses that combine galaxy clustering and weak lensing. In this paper, we propose a method for optimizing the tomographic binning choice for the lens sample of galaxies. We divide the CosmoDC2 and Buzzard simulated galaxy catalogs into a training set and an application set, where the training set is nonrepresentative in a realistic way, and then estimate photometric redshifts for the application sets. The galaxies are sorted into redshift bins covering equal intervals of redshift or comoving distance, or with an equal number of galaxies in each bin, and we consider a generalized extension of these approaches. We find that bins of equal comoving distance produce the highest dark energy figure of merit of the initial binning choices, but that the choice of bin edges can be further optimized. We then train a neural network classifier to identify galaxies that are either highly likely to have accurate photometric redshift estimates or highly likely to be sorted into the correct redshift bin. The neural network classifier is used to remove poor redshift estimates from the sample, and the results are compared to the case when none of the sample is removed. We find that the neural network classifiers are able to improve the figure of merit by ∼13% and are able to recover ∼25% of the loss in the figure of merit that occurs when a nonrepresentative training sample is used.