Although numerous studies have been conducted on niche and neutral theories to learn the drivers of species richness, few of them have demonstrated how to eliminate the influences of unlimited species numbers and absolute species equivalences which are contrary to many observations, and how to link space size with those drivers posited by the two theories. Here we present the environmental gradient per unit space metric that influences niche number, positively correlates with environmental filter and dispersal limitation and negatively correlates with space size occupied by each niche. This metric is incorporated with stochastic abundance and migration and equivalently average birth, death and dispersal of species. The simulation result of a model is consistent with the observation that a unimodal algal richness-water environmental gradient per unit space relationship. Therefore, the environmental gradient per unit space connecting deterministic and stochastic processes is an importantly measurable driver of species richness.