For convenience we let $x,y$ be the generic points of $Y_1$ and $Y_2$.
Let $U$ be any affine open subscheme of $X$ containing $x$ and $V$ be some affine open subscheme of $V$ containing $y$.
Then $U \cap V$ is an affine scheme. Now $O(U \cap V)$ is the subring of $K(X)$ generated by $O(U)$ and $O(V)$, thus it has a natural morphism of $O(V)$-algebras $O(U \cap V) \rightarrow O_{X,y}$. This corresponds to the canonical map $\operatorname{Spec}\,O_{V,y} \rightarrow V$ factoring through the inclusion $U \cap V \rightarrow V$, thus implying $y \in U \cap V \subset U$.
So any open subset containing $x$ contains $y$, thus $Y_1 \subset Y_2$.