Due to limited radio resources, non-orthogonal multiple access (NOMA) is a promising technology to enable massive connectivity in future 5G and beyond wireless networks. However, it suffers from the multiple access interference, which usually requires a high detection complexity to mitigate. In this paper, we consider NOMA with sparse multiple-access sequences, so as to leverage the message passing algorithm (MPA) for low-complexity and high-reliability multiuser detection. The optimal sparsity of spreading sequences is analyzed by minimizing the average bit error rate in the asymptotic large-system limit. Based on the analysis, the optimal sparse sequences that optimize the performance of MPA detector are designed in a systematically hierarchical way. The sparse structure is constructed given the target girth. Then, the values of nonzero entries are determined to maximize the minimum distance. The detection performance of the designed sparse sequences is presented for both additive white Gaussian noise and Rayleigh fading channels. Simulation results show the superiority of the proposed design in comparison with existing schemes.