The proper time to don tefillin is the first light of dawn. If one rose earlier than that, to go out on the road, and did not want to carry the tefillin in his hands, lest they become lost, he can don them immediately. When the prescribed time comes – that is, when he is able to recognize a friend at a distance of four steps – he should touch them and then recite the blessing.
The latest time to wear tefillin is when the sun sets. Rabbi Yakov says that one may leave the tefillin on until people have stopped walking the streets and no one can longer see him any longer. The Sages say that he may wear it until the time he decides to go to sleep. There a few possibilities to explain this argument: that the Torah prohibited wearing tefillin after sunset, that the Sages prohibited this out of concern for people falling asleep in their tefillin, or that no such prohibitions exist.
The rulings above apply mostly to the earlier times, when people wore tefillin all day. Nowadays they wear the tefillin only during the morning prayer.
Art: Adolph von Menzel- Schlafender - Man Asleep