In this paper we study the Nirenberg problem on standard half spheres (S n + , g), n ≥ 5, which consists of finding conformal metrics of prescribed scalar curvature and zero boundary mean curvature on the boundary. This problem amounts to solve the following boundary value problem involving the critical Sobolev exponent:where K ∈ C 3 (S n + ) is a positive function. This problem has a variational structure but the related Euler-Lagrange functional J K lacks compactness. Indeed it admits critical points at infinity, which are limits of non compact orbits of the (negative) gradient flow. Through the construction of an appropriate pseudogradient in the neighborhood at infinity, we characterize these critical points at infinity, associate to them an index, perform a Morse type reduction of the functional J K in their neighborhood and compute their contribution to the difference of topology between the level sets of J K , hence extending the full Morse theoretical approach to this non compact variational problem. Such an approach is used to prove, under various pinching conditions, some existence results for (P) on half spheres of dimension n ≥ 5.