Niemi turned aside all 22 shots he saw and Joe Pavelski scored his 30th and 31st goals for the Sharks, who reached the 40-win plateau for the eighth straight year and grabbed sole possession of the eighth and final Western Conference playoff slot.
Jason Demers also scored as San Jose took the first game of a crucial home-and-home series with Dallas.
Kari Lehtonen stopped 31-of-34 shots for the Stars, who lost for the sixth time in nine games.
Ninth-place Dallas fell one point behind the Sharks with three games remaining for both squads.
Celebrity Breakups and divorces of 2014 [PHOTOS]