A microscopic model is developed, within the frame of the theory of quantitative traits, to study the combined effect of competition and assortativity on the sympatric speciation process, i.e., speciation in the absence of geographical barriers. Two components of fitness are considered: a static one that describes adaptation to environmental factors not related to the population itself, and a dynamic one that accounts for interactions between organisms, e.g. competition. A simulated annealing technique was applied in order to speed up simulations. The simulations show that both in the case of flat and steep static fitness landscapes, competition and assortativity do exert a synergistic effect on speciation. We also show that competition acts as a stabilizing force against extinction due to random sampling in a finite population. Finally, evidence is shown that speciation can be seen as a phase transition.