There are two elements to the answer. The first is to understand what is $\psi(p)$ and the other the action of $\hat p$ on such functions.
To understand $\psi(p)$, the simplest is to refer to this question and adapt the answer to think of $\psi(p)=\langle p\vert \psi\rangle$. Much like $\vert x_0\rangle$ is such that $\hat x\vert x_0\rangle=x_0\vert x_0\rangle$, we have
$\vert p_0\rangle$ such that $\hat p\vert p_0\rangle=p_0\vert p_0\rangle$, i.e. the states $\vert p’\rangle$ are eigenstates of the operator $\hat p$ with eigenvalue $p’$.
Now, $\hat p\psi(p)$ is by definition
$$
\hat p\psi(p)\equiv \langle p\vert \hat p\vert\psi\rangle\, .
$$
The rest is just manipulations:
\begin{align}
\langle p\vert p\vert\psi\rangle =\langle \psi\vert \hat p^\dagger \vert p\rangle^*
&=\langle \psi\vert\hat p\vert p\rangle^* \qquad \qquad \hbox{since $\hat p$ is hermitian}\, ,\\
&=p\langle \psi\vert p\rangle^* \qquad \qquad \hbox{since eigenvalues of $\hat p$ are real}\, ,\\
&=p\langle p\vert\psi\rangle = p\psi(p)\, .
\end{align}
In other words, just like $\hat x$ is multiplication by $x$ on functions $\psi(x)$ of $x$, $\hat p$ is multiplication by $p$ on functions $\psi(p)$.
The interesting part is to obtain the action of $\hat x$ on functions $\psi(p)$. This is done by converting from the $p$-representation to the $x$-representation using the basic expression
$$
\langle x\vert p\rangle = \frac{1}{\sqrt{2\pi}}e^{i x p/\hbar}
$$
which follows because states of definite momentum $\vert p\rangle$ are expressed as plane wave in space, $e^{i x p/\hbar}$. The factor $1/\sqrt{2\pi}$ is there for convenience as the plane waves cannot be normalized. With this:
$$
\hat x\psi(p)\equiv \langle p\vert \hat x \vert \psi\rangle \tag{1}
$$
Inserting now the unit operator as a sum over all the $\vert x\rangle$ projections:
$$
\hat 1=\int dx \vert x\rangle \langle x\vert
$$
transforms (1) into
\begin{align}
X\psi(p)&=\int dx’
\langle p\vert \hat x \vert x’\rangle \langle x’\vert\psi\rangle\, ,\\
&=\int dx’ x’ \langle p\vert x’\rangle\langle \psi\rangle \, ,\\
&= \int dx’ x’ \frac{1}{\sqrt{2\pi}} e^{-i x’ p/\hbar} \psi(x)\, ,\\
&=i\hbar\frac{\partial}{\partial p}
\int dx’ \langle p\vert x’\rangle\langle x’\vert\psi\rangle\, ,\\
&=i\hbar \frac{\partial}{\partial p} \langle p\vert \psi\rangle \, ,\tag{2}\\
&=i\hbar \frac{\partial}{\partial p}\psi(p)\, . \tag{3}
\end{align}
There is a number of mathematically loose steps in there, but that’s the basic idea. In (2) I’ve used $\int dx’ \vert x’\rangle\langle x’\vert=\hat 1$ to get rid of the integral, and I’ve also assume that one can “pull out” the derivative w/r to $p$ out of the integral since I’m integrating over $x’$ but taking a derivative w/r to $p$.
Note the important sign difference between (3) and the more common action of $\hat p$ on $\psi(x)$.
You final query follows by using
$$
\langle p\vert \hat p \hat x\vert\psi\rangle =
\langle \psi \hat x\hat p\vert p\rangle ^* =
p\langle p\vert \hat x\vert\psi\rangle
$$
where I’ve use hermiticity of $\hat x$ and $\hat p$, and the reality of the eigenvalue $p$.