As mentioned, the tefillin may not go beneath the hairline. Regarding how high on the head the tefillin may be placed, there is a disagreement among the Rishonim. Some say that they can be placed anywhere on the curve of the head. Others say that they should not be placed higher than halfway up the front slope of the head. L’chatchilah, the second view should be followed. If one is concerned that the tefillin may slip onto his forehead, however, it is better to pull them higher (and rely on the first view) than to allow them to slip too low.
[שו"ע כז, ט, משנ"ב לד, וביה"ל ד"ה ע]