We consider the problem of prescribing conformally the scalar curvature on compact manifolds of positive Yamabe class in dimension $n geq 5$. We prove new existence results using Morse theory and some analysis on blowing-up solutions, under suitable pinching conditions on the curvature function. We also provide new non-existence results showing the sharpness of some of our assumptions, both in terms of the dimension and of the Morse structure of the prescribed function.