What is the connection between the current Pesukim?
Seforno (on Pasuk #!): Now that you see that Hashem is prepared to send you into exile in the event that you sin, 1 take care to observe His Mitzvos without adding to or subtracting from them, not even if the reason behind the Mitzvah no longer applies. 2 Because the slightest deviation from the Mitzvos brings destruction in its wake - like what happened by Ba'al Pe'or, where the men intended only to be intimate 3 with the Midyanite women without worshipping their idols. 4 But in the end, everyone who began with Z'nus ended up serving idolatry, and was wiped out.
Divrei Eliyahu: The Torah said "Al Tifnu el ha'Elilim"
Seforno (citing Sanhedrin, 21b): Like Sh'lomoh ha'Melech said 'I will add [extra wives] and I will not sin ... !'; but he did
Seforno: Which is prohibited mainly in order to avoid worshipping their idols.
Seforno: As the Pasuk wrote in Balak Bamidbar, 25:1.
We see that one may not rely on one's intellect to add or detract from Mitzvos, even le'Shem Shamayim!