“fear Yahweh your God by keeping.” “Fearing God” (which includes both fear and reverence) is integrally tied to obeying God. The person who says, “I revere (reverence, love) God” but does not keep His commands is fooling himself. Jesus taught, “If you love me, you will keep my commandments” (John 14:15); “Whoever has my commandments, and is keeping them, that is the one who loves me” (John 14:21); “If anyone loves me, he will keep my word” (John 14:23); and “Whoever does not love me does not keep my words” (John 14:24). Peter Craigie translates the phrase: “fear the Lord your God by keeping all his statutes and commandments” (The New International Commentary on the Old Testament), and the JPS Torah Commentary has the comment: “Literally, ‘revere...by following.’” Everett Fox (The Schocken Bible) has, “in order that you may hold YHWH your God in awe, by keeping all his laws and his commandments….” People who reverence God obey God.
“and so that your days may be prolonged.” The primary meaning of this phrase it that when the people of Israel obey God then the country (the “your” in the verse is plural) will be blessed by God and so the people will live long and blessed lives. However, in cases like this, although the primary emphasis is on Israel as a community, there is also an unstated secondary meaning that the people will live forever because they loved and obeyed God.