Multiple sequence alignment (MSA) is an NP-complete and important problem in bioinformatics. Currently, profile hidden Markov model (HMM) is widely used for multiple sequence alignment. In this paper, Quantum-behaved Particle Swarm Optimization with selection operation (SQPSO) is presented, which is used to train profile HMM. Furthermore, an integration algorithm based on the profile HMM and SQPSO for the MSA is constructed. The approach is examined by using multiple nucleotides and protein sequences and compared with other algorithms. The results of the comparisons show that the HMM trained with SQPSO and QPSO yield better alignments than other most commonly used HMM training methods such as Baum–Welch and PSO.