A two-phase Stefan problem with heat source terms of a general similarity type in both liquid and solid phases for a semi-infinite phase-change material is studied. We assume the initial temperature is a negative constant and we consider two different boundary conditions at the fixed face x = 0, a constant temperature or a heat flux of the form −q 0 / √ t (q 0 > 0). The internal heat source functions are given byare functions with appropriate regularity properties, ρ is the mass density, l is the fusion latent heat by unit of mass, a 2 j is the diffusion coefficient, x is the spatial variable and t is the temporal variable. We obtain for both problems explicit solutions with a restriction for data only for the second boundary conditions on x = 0. Moreover, the equivalence of the two free boundary problems is also proved. We generalize the solution obtained in [J.L. Menaldi, D.A. Tarzia, Generalized Lamé-Clapeyron solution for a one-phase source Stefan problem, Comput. Appl. Math. 12 (2) (1993) 123-142] for the one-phase Stefan problem. Finally, a particular case where β j (j = 1, 2) are of exponential type given by β j (x) = exp(−(x + d j ) 2 ) with x and d j ∈ R is also studied in details for both boundary temperature conditions at x = 0. This type of heat source terms is important through the use of microwave energy following [E.P. Scott, An analytical solution and sensitivity study of sublimation-dehydration within a porous medium with volumetric heating, J. Heat Transfer 116 (1994) 686-693]. We obtain a unique solution of the similarity type for any data when a temperature boundary condition at the fixed face x = 0 is considered; a similar result is obtained for a heat flux condition imposed on x = 0 if an inequality for parameter q 0 is satisfied.