We analytically work out the long-term variations caused on the motion of a planet orbiting a star by a very distant, pointlike massive object X. Apart from the semi-major axis a, all the other Keplerian osculating orbital elements experience long-term variations which are complicated functions of the orbital configurations of both the planet itself and of X. We infer constraints on the minimum distance d_X at which X may exist by comparing our prediction of the long-term variation of the longitude of the perihelion \varpi to the latest empirical determinations of the corrections \Delta\dot\varpi to the standard Newtonian/Einsteinian secular precessions of several solar system planets recently estimated by independent teams of astronomers. We obtain the following approximate lower bounds on dX for the assumed masses of X quoted in brackets: 150 - 200 au (m_Mars), 250 - 450 au (0.7 m_Earth), 3500 - 4500 au (4 m_Jup).