In prayer, it is better to recite from memory. See question no. 3465.
Outside of prayer, it is better for a person to do that which will increase his khushoo’ (humility, focus). If his khushoo’ will be increased by reciting from memory, then that is better; if his khushoo’ will be increased by reading from the Mus-haf, then that is better. If it is the same in either case, then reading from the Mus-haf is better, because it combines reading and looking, and his eyes will be protected from looking at things that may distract him from reciting and pondering the meaning.
Al-Nawawi said in al-Adhkaar (p. 90-91):
Reading Qur’aan from the Mus-haf is better than reciting from memory; this is the view of our companions and it is well known from the salaf (may Allaah be pleased with them). This does not apply in all cases however; if the reader can focus and ponder the meanings more when reciting from memory than when reading from the Mus-haf, then reciting from memory is better. If it is the same in both cases, then reading from the Mus-haf is better. This is what the salaf meant.
There are weak (da’eef) ahaadeeth narrated from the Prophet (peace and blessings of Allaah be upon him) which cannot be used as proof that it is better to look at the Mus-haf. We mention them only to draw attention to the fact that they are weak. These include:
“Looking at the Mus-haf is an act of worship; for a child to look at his parents is an act of worship; looking at ‘Ali ibn Abi Taalib is an act of worship.” This is a fabricated (mawdoo’) hadeeth, as al-Albaani said in al-Silsilah al-Da’eefah, 1/531.
“Give your eyes their share of worship: looking at the Mus-haf, thinking about it and pondering its wonders.” This is also fabricated (mawdoo’). Al-Silsilah al-Da’eefah, 4/88.
“Five things are acts of worship: eating little, sitting in the mosque, looking at the Ka’bah, looking at the Mus-haf and looking at the face of a scholar.” This is a very weak (da’eef jiddan) hadeeth. Da’eef al-Jaami’ al-Sagheer, no. 2855.
And Allaah knows best.