Every binary relation $R$ has a representation with $d=2$. Enumerate $X=\{x_i:i\in[n]\}$, and define $g\colon X\to\mathbb R^2$ by $g(x_i)=(i,-i)$. Since $\{(i,-i,j,-j):i,j\in[n]\}$ is a set of pairwise incomparable elements of $\mathbb R^4$, the Proposition below implies that there exists a continuous increasing function $f\colon\mathbb R^4\to\mathbb R$ such that
$$f(i,-i,j,-j)=\begin{cases}\phantom-1&x_i\mathrel Rx_j,\\-1&\text{otherwise,}\end{cases}$$
whence
$$x_i\mathrel Rx_j\iff f(g(x_i),g(x_j))>0$$
as required.
Proposition. Let $d\in\mathbb N$ and $X\subseteq\mathbb R^d$ be finite. Then any nondecreasing (w.r.t. the coordinatewise partial order on $\mathbb R^d$) function $f\colon X\to\mathbb R$ extends to a continuous nondecreasing function $\tilde f\colon\mathbb R^d\to\mathbb R$. If $f$ is strictly increasing, $\tilde f$ can be taken strictly increasing as well.
(More generally, the argument below can be adapted to $X\subseteq\mathbb R^d$ whose projection to each coordinate is a subset of $\mathbb R$ with no accummulation point.)
I will outline a proof in the strictly increasing case; the nondecreasing case is completely analogous.
First, we can extend $f$ to any countable set by iterating the following observation:
Lemma. If $X\subseteq\mathbb R^d$ is finite and $y\in\mathbb R^d$, then any increasing $f\colon X\to\mathbb R$ extends to an increasing function $g\colon X\cup\{y\}\to\mathbb R$.
Proof: Assume $y\notin X$. Putting $r=\max\{f(x):x\in X,x<y\}$ and $s=\min\{f(x):x\in X,y<x\}$, it suffices to define $g(y)$ so that $r<g(y)<s$, which is possible as $r<s$. If $r$ or $s$ does not exist due to the relevant set being empty, we ignore the corresponding constraint. QED
Corollary. If $X\subseteq Y\subseteq\mathbb R^d$, $X$ is finite, and $Y$ is countable, then any increasing $f\colon X\to\mathbb R$ extends to an increasing function $g\colon Y\to\mathbb R$.
Proof: Write $Y=\{y_n:n\in\omega\}$. Using the Lemma, construct a sequence of $f=f_0\subseteq f_1\subseteq f_2\subseteq\cdots$ of increasing functions $f_n\colon X\cup\{y_i:i<n\}\to\mathbb R$, and put $ g=\bigcup_nf_n$. QED
At this point, we could extend a given $f\colon X\to\mathbb R$ to an increasing $\bar f\colon Y\to\mathbb R$ for a countable dense set $Y$, and define $\tilde f\colon\mathbb R^d\to\mathbb R$ by $\tilde f(x)=\sup\{\bar f(y):y\le x,y\in Y\}$; this will be an increasing function, but may well be discontinuous. Thus, we need to work a bit harder.
Let $Z=\{z_n:n\in\mathbb Z\}\subseteq\mathbb R$ be a set such that $n<m\implies z_n<z_m$, $\inf Z=-\infty$, $\sup Z=+\infty$, and $Z$ contains all coordinates of all elements of $X$. Using the Corollary, we can extend any increasing $f\colon X\to\mathbb R$ to an increasing $f_0\colon Z^d\to\mathbb R$. By applying a suitable continuous increasing bijection $\mathbb R\to\mathbb R$, we may assume $Z=\mathbb Z$ without loss of generality.
We now extend the increasing function $f_0\colon\mathbb Z^d\to\mathbb R$ to a function $f_1\colon(\frac12\mathbb Z)^d\to\mathbb R$ as follows. Any $x\in(\frac12\mathbb Z)^d$ can be written uniquely as $x=(x_0+x_1)/2$, where $x_0,x_1\in\mathbb Z^d$, $x_0\le x_1$, and $\|x_1-x_0\|_\infty\le1$; we define $f_1(x)=\frac12(f_0(x_0)+f_0(x_1))$.
Let $x,y\in(\frac12\mathbb Z)^d$ be neighbouring lattice points, i.e., $x<y$ and $\|y-x\|_1=1/2$. We have either $x_0=y_0$, $x_1<y_1$, and $\|y_1-x_1\|_1=1$, or $x_0<y_0$, $\|y_0-x_0\|_1=1$, and $x_1=y_1$. In the former case, $f_1(y)-f_1(x)=\frac12(f_0(y_1)-f_0(x_1))$, while in the latter case, $f_1(y)-f_1(x)=\frac12(f_0(y_0)-f_0(x_0))$. In particular, $f_1(y)>f_1(x)$. Since we can get from any $x$ to any $y>x$ by an increasing sequence of lattice neighbour hops, this implies that $f_1$ is increasing.
But the argument gives more. Assume $n\in\mathbb N$ and $t>0$ are such that $f_0$ is $t$-Lipschitz on $[-n,n]^d$ w.r.t. the $\|\cdot\|_1$ norm:
$$x,y\in(\mathbb Z\cap[-n,n])^d\implies|f_0(y)-f_0(x)|\le t\|y-x\|_1.$$
Then we obtain $|f_1(y)-f_1(x)|\le t/2$ when $y,x\in[-n,n]^d$ are neighbours in the $(\frac12\mathbb Z)^d$ lattice, which implies that $f_1$ is $t$-Lipschitz on $[-n,n]^d$ w.r.t. $\|\cdot\|_1$ as well.
Thus, if we iterate this process to construct a sequence $f_0\subseteq f_1\subseteq f_2\subseteq\cdots$ of increasing functions $f_i\colon(2^{-i}\mathbb Z)^d\to\mathbb R$, they will have the property that for any $n\in\mathbb N$ and $t>0$, if $f_0$ is $t$-Lipschitz on $[-n,n]^d$, then all $f_i$ are $t$-Lipschitz on $[-n,n]^d$.
Let $\bar f=\bigcup_if_i$. Then $\bar f$ is an increasing function $\mathbb D^d\to\mathbb R$, where $\mathbb D=\bigcup_i2^{-i}\mathbb Z$ is the set of dyadic rationals, and for every $n\in\mathbb N$, there exists $t>0$ such that $\bar f$ is $t$-Lipschitz, hence uniformly continuous, on $[-n,n]^d$. It follows that $\bar f$ has a unique continuous extension $\tilde f\colon\mathbb R^d\to\mathbb R$, and this has to be increasing as well.
EDIT: A more explicit description of the extension of $f_0\colon\mathbb Z^d\to\mathbb R$ to $\tilde f\colon\mathbb R^d\to\mathbb R$ above can be given as follows. We consider a triangulation of $\mathbb R^d$ whose faces are the simplices $\operatorname{Conv}\{x_0,\dots,x_k\}$ where $x_0,\dots,x_k\in\mathbb Z^d$ are such that $x_0<x_1<\dots<x_k$ and $\|x_k-x_0\|_\infty\le1$. (One needs to check that this is indeed a triangulation.) We then define $\tilde f$ such that its restriction to each simplex in the triangulation is the unique affine function that agrees with $f_0$ at the vertices of the simplex. This is a continuous extension of $f_0$, and one can check easily that it is increasing.