It's not only context. The only tricky one is φίλος (note that η φίλη μου is not used by men for a girlfriend). Το αγόρι μου/η κοπέλα μου/το κορίτσι μου always mean my boyfriend/girlfriend. But ο φίλος μου is my boyfriend. So, Ο Γιάννης είναι ο φίλος μου=Yiannis is my boyfriend, but Ο Γιάννης είναι φίλος μου=Yannis is my friend. Πήγα με τον φίλο μου μια βόλτα=(mostly) I went for a walk with my boyfriend, but in such sentences if the friend is specified for example Πήγα με τον φίλο μου τον Νίκο μια βόλτα=I went for a walk with my friend Nikos, unless you say Πήγα με τον φίλο μου, τον Νίκο, μια βόλτα=I went for a walk with my boyfriend, Nikos. I hope I helped and did not overwhelm you with too much info.... :)
I agree with Nathan Fox and I would add that, nowadays, i.e. young people would ask "You have a girlfriend?" omitting the "Do" and emphasising that it is a question by audibly raising the pitch of the voice when saying "... friend". So I ask that Nathan and my answer is accepted.