Rambam in Sefer Hamitzvot Asseh 8 writes as follows:
The Torah instructs us to emulate God as much as we can. The Torah says Devarim 28:9
ט יְקִימְךָ יְהוָה לוֹ לְעַם קָדוֹשׁ, כַּאֲשֶׁר נִשְׁבַּע-לָךְ: כִּי תִשְׁמֹר, אֶת-מִצְוֹת יְהוָה אֱלֹהֶיךָ, וְהָלַכְתָּ, בִּדְרָכָיו.
9 The LORD will establish thee for a holy people unto Himself, as He hath sworn unto thee; if thou shall keep the commandments of the LORD thy God, and walk in His ways.
And in Devarim 10:12
יב וְעַתָּה, יִשְׂרָאֵל--מָה יְהוָה אֱלֹהֶיךָ, שֹׁאֵל מֵעִמָּךְ: כִּי אִם-לְיִרְאָה אֶת-יְהוָה אֱלֹהֶיךָ לָלֶכֶת בְּכָל-דְּרָכָיו, וּלְאַהֲבָה אֹתוֹ, וְלַעֲבֹד אֶת-יְהוָה אֱלֹהֶיךָ, בְּכָל-לְבָבְךָ וּבְכָל-נַפְשֶׁךָ.
12 And now, Israel, what doth the LORD thy God require of thee, but to fear the LORD thy God, to walk in all His ways, and to love Him, and to serve the LORD thy God with all thy heart and with all thy soul;
And further in Devarim 11:22
כב כִּי אִם-שָׁמֹר תִּשְׁמְרוּן אֶת-כָּל-הַמִּצְוָה הַזֹּאת, אֲשֶׁר אָנֹכִי מְצַוֶּה אֶתְכֶם--לַעֲשֹׂתָהּ: לְאַהֲבָה אֶת-יְהוָה אֱלֹהֵיכֶם, לָלֶכֶת בְּכָל-דְּרָכָיו--וּלְדָבְקָה-בוֹ.
22 For if ye shall diligently keep all this commandment which I command you, to do it, to love the LORD your God, to walk in all His ways, and to cleave unto Him.
We received the correct interpretation of “walking in God’s ways” from Sinai, that it means to emulate Him. Just as God is seen as compassionate so should you be, just as God is seen as gracious so should you be, just as God is seen as just so should you be, just as God is seen as faithful so should you be. This same rule was repeated in different words in Devarim 13:5
ה אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ, וְאֹתוֹ תִירָאוּ; וְאֶת-מִצְוֹתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ, וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן.
5 After the LORD your God shall ye walk, and Him shall ye fear, and His commandments shall ye keep, and unto His voice shall ye hearken, and Him shall ye serve, and unto Him shall ye cleave.
And we received from Sinai that it means to emulate the good deeds and the important attributes that describe God who is far above all.
The above is as usual a paraphrase/translation of the sefer Hamitzvot.
In every one of the above verses, there are clearly distinct components. Walking in God’s ways is separate from keeping His Mitzvot, loving Him or attaching oneself to Him. Each of the admonishments needs to be defined separately. On the obligation to walk in His ways, we received a Sinaitic interpretation that it means emulating God. "Receiving an interpretation from Sinai" according to Rambam means that no one can disagree with it. It has the same authority as the written Law and is the original Torah Sheba'al Peh, the Oral Law received parallel with the written one. (See his introduction to Pirush Hamishna at length and Hilchot Mamrim 1:3 and hopefully the subject of a future post).
In Hilchot De’ot 1:5, after explaining his understanding of the famous Golden Mean, the finely balanced and finely tuned person one should strive to be, he tells us:
יא ומצווין אנו ללכת בדרכים אלו הבינוניים, והם הדרכים הטובים והישרים, שנאמר "והלכת, בדרכיו" (דברים כח,ט). [ו] כך לימדו בפירוש מצוה זו: מה הוא נקרא חנון, אף אתה היה חנון; מה הוא נקרא רחום, אף אתה היה רחום; מה הוא נקרא קדוש, אף אתה היה קדוש. ועל דרך זו קראו הנביאים לאל בכל אותן הכינויין, ארך אפיים ורב חסד צדיק וישר תמים גיבור וחזק וכיוצא בהן--להודיע שאלו דרכים טובים וישרים הם, וחייב אדם להנהיג עצמו בהן ולהידמות כפי כוחו.
We are commanded to walk in these middle ways, the good and upright ways, as it is written, "And walk in His ways, et cetera". This is how they taught us to interpret this injunction, just as God is seen as gracious so also should we be gracious, just as God is compassionate so also should we be compassionate, and just as God is holy so also should we be holy. It was with this in mind that the Prophets referred to the Almighty using all those attributes; long-suffering, magnanimous, righteous, upright, faultless, mighty, and strong and other similar ones. [They did so] in order to make it known that these are good and upright ways and that one is obligated to accustom oneself to them, and to make one's ways as similar to them as possible.
(Courtesy of http://www.panix.com/~jjbaker/MadaD.html with my changes as I saw fit).
The middle ways we are talking about are not the Mitzvot themselves but what following the Mitzvot is supposed to make us become – people who are in complete control of our urges, emotions and most importantly our narcissism. It is only as such that we can properly emulate God and partake with Him in what He does by definition – existence.
In MN 1:54 Rambam explains in more detail what it means to learn to emulate God. A person explores the world he lives in, trying to understand how it functions.
“We see for example how well He provides for the life of the embryo of living beings. We also note how He endows with certain faculties both the embryo itself and those who have to rear it after its birth, in order that it may be protected from death and destruction, guarded against all harm, and assisted in the performance of all that is required [for its development]. Similar acts, when performed by us, are due to a certain emotion and tenderness called compassion. Therefore God is said to be compassionate.”
Having understood that God acts in this way does not automatically translate in emulating Him. We know many scientists who were not necessarily nice people although they understood God’s ways. That is where Mitzvot come in – to train and teach us discipline. They force us to look at ourselves, to set limits to our urges and to do things other than just to satisfy our selfish needs.
“What I have here pointed out to you is the object of all our religious acts. For by [carrying out] all the details of the prescribed practices, and repeating them continually, some few pious men may attain human perfection. They will be filled with respect and reverence towards God; and bearing in mind who is with them, they will perform their duty”. (MN 3:52)
Having become this better and perfected human being and at the same time tried to find God and understand His ways, we now can accomplish our obligation to emulate Him.
“He [Yirmyahu] says however, that man can only glory in the knowledge of God and in the knowledge of His ways and attributes, which are His actions, as we have shown (Part 1. liv.) in expounding the passage, "Show me now thy ways" (Exod. xxxviii. 13). We are thus told in this passage that the Divine acts which ought to be known, and ought to serve as a guide for our actions, are, Chesed, "loving-kindness," Mishpat, "judgment," and Tzedakah, "righteousness." (MN 3:54).
This is just a short summary of this most important Mitzvah. As time goes on and the “spirit” leads me, I will write more about it. It is a key component of Providence, rather Divine Providence, and a basic building block of Jewish Theology.