Let $A=K[[X_1,\dots,X_n]]$ where $K$ is a field. Let $M$ be a finitely generated torsion-free $A$-module, such that

1. for all $k$, the $A[1/X_k]$-module $M[1/X_k]$ is free of rank $d$;
2. for every $i \neq j$, we have $M = M[1/X_i] \cap M[1/X_j]$.

Does this imply that $M$ is free?

It certainly does if $n=1$ (easy), and also if $n=2$ (reduce $M$ modulo $X$), but things seem trickier if $n \geq 3$.

This question comes up when trying to prove that some $(\varphi,\Gamma)$-modules over rings in several variables are free.

-

No, this is false as soon as $n ≥ 3$. A second syzygy $M$ of the residue field $K$ gives a counterexample: each $M[1/X_i]$ is projective, hence free, and it is reflexive, so the second condition is satisfied. On the other hand the projective dimension of $K$ as a module is $n$, so $M$ can not be free.
I think the answer is no. Suppose $M = B$ is a finite ring extension of $A$, say with an isolated singularity, which is both Cohen-Macaulay except over the closed point of $A$ and normal.
Then $M$ cannot be free, since free modules are Cohen-Macaulay. On the other hand, it is free away from the closed point by the Cohen-Macaulay hypothesis. The second hypothesis follows from the S2 assumption.