I'm dealing with a regression problem and have two datasets at my disposal. Dataset A is properly labeled and I use it to fit and validate my model, B is unlabeled and I can only visually inspect performance of my model on that. For all practical purposes, B can be thought of as real-world data that I'd like to deploy a trained model on, so naturally the results on this data are more important.
The problem is that A and B have been drawn from slightly different "areas" in the problem domain. When I randomly split A into train and validation subsets, I often obtain a fit with a very good $R^2$ on the validation data which however performs very poorly on the test set B. My understanding is that this is because the model interpolates during validation on the subset of A, while it extrapolates on B. The figure below illustrates this case on a simple 1-D example:
Is there a way to perform the training&validation procedure on A in such a way that would give me a better estimation on the model's extrapolation performance on B? Or, more generally, what should I read to understand that what I'm trying to do is either called X and I should just refer to some source, or generally impossible and/or wrong because of Y and I should read that instead, or there exists a better approach Z that I should get acquainted with?
What I came up with so far is a "structured" way of splitting A into train and val subsets - instead of a random split that evenly samples A, perform a "cut" and assign samples to the subsets by their location in the space (example in the figure below). This would force the model to extrapolate during validation on A. I have already sketched a proof-of-concept basing on a zero-centering my data and cutting a sphere of some radius (selected to achieve a desired proportion of train/val sample counts); the model is fit to the data from inside the sphere and validated everywhere outside it. In this situation, poor $R^2$ on the validation subset of A does give me some indication of poor quality of fit on B. But is this methodologically valid? Is there something I could quote instead of giving an elaborate explanation of this procedure in my paper (which is not statistic-centric, I just use regression to solve a real problem).

