The Shuhan Aruch (O.H. 37:1) writes that there is great reward for donning Tefilin, but that one who willingly does not wear is considered to be among those who sin with their body.
The Shulhan Aruch (O.H. ibid:2) goes on to say that ideal way to fulfill the Mitzvah of Tefilin is to don them the entire day. Nevertheless, since people experience bodily functions throughout the day, including passing gas, it would be inappropriate to wear them all day. Furthermore, Tefilin require proper concentration, which cannot realistically be maintained throughout the day. As such, the practice is not to wear Tefilin all day but rather to don them once and remove them after praying. That being said, the Ben Ish Hai (Parashat Haye Sarah, § 11) says that one should leave on one’s Tefilin after the prayer and learn some Torah, because by doing so, one acquires one’s Nefesh, Ruah and Neshama (different levels of one’s soul). Additionally, the Kaf HaHaim (O.H. 25:90) writes that by learning with wearing the Tefilin specifically in the synagogue, one becomes enveloped by a Divine flow of spiritual energy.
One question that arises regards the donning of Tefilin during Minha of a public fast. According to the Moroccan custom, Tefilin are donned at this time. If someone is praying in a community where this is not the custom but wishes to do so oneself, it may be considered in violation of Lo Titgodedu. This Mitzvah prohibits creating factions among Jews when some observe one law while others follow another law. Nonetheless, in this case, the community does not oppose wearing Tefilin during Minha or all day for that matter, but rather because of specific reasons did not have the custom to re-don them in Minha. Indeed, in an ideal situation one should wear Tefilin all day including Minha. Therefore, Rabbi Ben Zion Abba Shaul (Or Lezion, vol. II, ch. 3, § 12) writes that one may wear Tefilin in Minha of a public fast even if among a community that does not do so and would not be in violation of Lo Titgodedu.
Summary: One should strive to keep on one’s Tefilin after the prayer even for a short while and to learn some Torah. One may wear Tefilin during Minha of a public fast if praying in a community that does not wear Tefilin at that time.