The rough idea is to use that $\mathcal{X}$ has a dense open which is a gerbe (Morphisms of Stacks, Proposition \ref{stacks-morphisms-proposition-open-stratum}) and appeal to Lemma \ref{lemma-make-section}. The reason this does not work is that the open may not be quasi-compact and one runs into technical problems. Thus we first do a (standard) reduction to the Noetherian case. \medskip\noindent First we choose a closed immersion $\mathcal{X} \to \mathcal{X}'$ where $\mathcal{X}'$ is an algebraic stack separated and of finite type over $Y$. See Limits of Stacks, Lemma \ref{stacks-limits-lemma-separated-closed-in-finite-presentation}. Clearly it suffices to prove the theorem for $\mathcal{X}'$, hence we may assume $\mathcal{X} \to Y$ is separated and of finite presentation. \medskip\noindent Assume $\mathcal{X} \to Y$ is separated and of finite presentation. By Limits of Spaces, Proposition \ref{spaces-limits-proposition-approximate} we can write $Y = \lim Y_i$ as the directed limit of a system of Noetherian algebraic spaces with affine transition morphisms. By Limits of Stacks, Lemma \ref{stacks-limits-lemma-descend-a-stack-down} there is an $i$ and a morphism $\mathcal{X}_i \to Y_i$ of finite presentation from an algebraic stack to $Y_i$ such that $\mathcal{X} = Y \times_{Y_i} \mathcal{X}_i$. After increasing $i$ we may assume that $\mathcal{X}_i \to Y_i$ is separated, see Limits of Stacks, Lemma \ref{stacks-limits-lemma-eventually-separated}. Then it suffices to prove the theorem for $\mathcal{X}_i \to Y_i$. This reduces us to the case discussed in the next paragraph. \medskip\noindent Assume $Y$ is Noetherian. We may replace $\mathcal{X}$ by its reduction (Properties of Stacks, Definition \ref{stacks-properties-definition-reduced-induced-stack}). This reduces us to the case discussed in the next paragraph. \medskip\noindent Assume $Y$ is Noetherian and $\mathcal{X}$ is reduced. Since $\mathcal{X} \to Y$ is separated and $Y$ quasi-separated, we see that $\mathcal{X}$ is quasi-separated as an algebraic stack. Hence the inertia $\mathcal{I}_\mathcal{X} \to \mathcal{X}$ is quasi-compact. Thus by Morphisms of Stacks, Proposition \ref{stacks-morphisms-proposition-open-stratum} there exists a dense open substack $\mathcal{V} \subset \mathcal{X}$ which is a gerbe. Let $\mathcal{V} \to V$ be the morphism which expresses $\mathcal{V}$ as a gerbe over the algebraic space $V$. See Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-gerbe-over-iso-classes} for a construction of $\mathcal{V} \to V$. This construction in particular shows that the morphism $\mathcal{V} \to Y$ factors as $\mathcal{V} \to V \to Y$. Picture $$ \xymatrix{ \mathcal{V} \ar[r] \ar[d] & \mathcal{X} \ar[d] \\ V \ar[r] & Y } $$ Since the morphism $\mathcal{V} \to V$ is surjective, flat, and of finite presentation (Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-gerbe-fppf}) and since $\mathcal{V} \to Y$ is locally of finite presentation, it follows that $V \to Y$ is locally of finite presentation (Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-flat-finite-presentation-permanence}). Note that $\mathcal{V} \to V$ is a universal homeomorphism (Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-gerbe-bijection-points}). Since $\mathcal{V}$ is quasi-compact (see Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-locally-closed-in-noetherian}) we see that $V$ is quasi-compact. Finally, since $\mathcal{V} \to Y$ is separated the same is true for $V \to Y$ by Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-check-separated-on-ui-cover} applied to $\mathcal{V} \to V \to Y$ (whose assumptions are satisfied as we've already seen). \medskip\noindent All of the above means that the assumptions of Limits of Spaces, Lemma \ref{spaces-limits-lemma-embedding-into-affine-over-qs} apply to the morphism $V \to Y$. Thus we can find a dense open subspace $V' \subset V$ and an immersion $V' \to \mathbf{P}^n_Y$ over $Y$. Clearly we may replace $V$ by $V'$ and $\mathcal{V}$ by the inverse image of $V'$ in $\mathcal{V}$ (recall that $|\mathcal{V}| = |V|$ as we've seen above). Thus we may assume we have a diagram $$ \xymatrix{ \mathcal{V} \ar[rr] \ar[d] & & \mathcal{X} \ar[d] \\ V \ar[r] & \mathbf{P}^n_Y \ar[r] & Y } $$ where the arrow $V \to \mathbf{P}^n_Y$ is an immersion. Let $\mathcal{X}'$ be the scheme theoretic image of the morphism $$ j : \mathcal{V} \longrightarrow \mathbf{P}^n_Y \times_Y \mathcal{X} $$ and let $Y'$ be the scheme theoretic image of the morphism $V \to \mathbf{P}^n_Y$. We obtain a commutative diagram $$ \xymatrix{ \mathcal{V} \ar[r] \ar[d] & \mathcal{X}' \ar[r] \ar[d] & \mathbf{P}^n_Y \times_Y \mathcal{X} \ar[d] \ar[r] & \mathcal{X} \ar[d] \\ V \ar[r] & Y' \ar[r] & \mathbf{P}^n_Y \ar[r] & Y } $$ (See Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-factor-factor}). We claim that $\mathcal{V} = V \times_{Y'} \mathcal{X}'$ and that Lemma \ref{lemma-make-section} applies to the morphism $\mathcal{X}' \to Y'$ and the open subspace $V \subset Y'$. If the claim is true, then we obtain $$ \xymatrix{ \overline{X} \ar[rd]_{\overline{g}} & X \ar[l] \ar[d]_g \ar[r]_h & \mathcal{X}' \ar[ld]^f \\ & Y' } $$ with $X \to \overline{X}$ an open immersion, $\overline{g}$ and $h$ proper, and such that $|V|$ is contained in the image of $|g|$. Then the composition $X \to \mathcal{X}' \to \mathcal{X}$ is proper (as a composition of proper morphisms) and its image contains $|\mathcal{V}|$, hence this composition is surjective. As well, $\overline{X} \to Y' \to Y$ is proper as a composition of proper morphisms. \medskip\noindent The last step is to prove the claim. Observe that $\mathcal{X}' \to Y'$ is separated and of finite type, that $Y'$ is quasi-compact and quasi-separated, and that $V$ is quasi-compact (we omit checking all the details completely). Next, we observe that $b : \mathcal{X}' \to \mathcal{X}$ is an isomorphism over $\mathcal{V}$ by Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-scheme-theoretic-image-of-partial-section}. In particular $\mathcal{V}$ is identified with an open substack of $\mathcal{X}'$. The morphism $j$ is quasi-compact (source is quasi-compact and target is quasi-separated), so formation of the scheme theoretic image of $j$ commutes with flat base change by Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-existence-plus-flat-base-change}. In particular we see that $V \times_{Y'} \mathcal{X}'$ is the scheme theoretic image of $\mathcal{V} \to V \times_{Y'} \mathcal{X}'$. However, by Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-universally-closed-permanence} the image of $|\mathcal{V}| \to |V \times_{Y'} \mathcal{X}'|$ is closed (use that $\mathcal{V} \to V$ is a universal homeomorphism as we've seen above and hence is universally closed). Also the image is dense (combine what we just said with Morphisms of Stacks, Lemma \ref{stacks-morphisms-lemma-topology-scheme-theoretic-image}) we conclude $|\mathcal{V}| = |V \times_{Y'} \mathcal{X}'|$. Thus $\mathcal{V} \to V \times_{Y'} \mathcal{X}'$ is an isomorphism and the proof of the claim is complete.