We have investigated the effect of Ti and Mg dopants on the structural properties and band-gap energies of Ba0.5Sr0.5TiO3 (BST) thin films grown on LaAlO3 substrates. The transmission spectra of these BST thin films measured by ultraviolet-visible spectrophotometer show that the band-gap energies are strongly dependent on the dopant concentration. Based on the structural analyses and theoretical calculation, the variation of the band-gap energies can be attributed to the combined effects of stress, grain size, and phase transformation in Ti- and Mg-doped BST thin films.