To realize the practical implementation of device-independent quantum key distribution (DIQKD), the main difficulty is that its security is solely based on the detection loophole-free violation of the Clauser-Horne-Shimony-Holt (CHSH) inequality i.e. the CHSH value S > 2 . To circumvent the inevitable losses in the transmission channels which create the detection loophole, several probabilistic methods to recover the nonlicality have been proposed. Here, we theoretically and experimentally investigate the optimal strategy for the method utilizing linear optical entanglement swapping relay (ESR) with photon pairs from spontaneous parametric-down conversion (SPDC) sources [2,3]. In the previous methods, it is common to employ the ESR node in Bob's system as shown in Fig. 1(a) (Hereafter, we call this configuration the local-heralding (LH).). We employ another configuration: The middle-heralding (MH) shown in Fig. 1(b), where the ESR node is placed in the middle of Alice and Bob similar to the measurement device independent QKD. We numerically compare S of the above two schemes by using the numerical simulation based on the characteristic-function approach . The results are shown in Fig. 1(c). We see that the larger values of S are expected in the MH scheme when the dark count probabilities (ν) of the detectors are considered. In experiment, we perform the Bell-test experiment using the ESR with SPDC sources. We employ the MH scheme, and measure S changing the transmission losses. The experimental parameters (the average photon numbers and measurement angles) are chosen such that S is maximized under the condition of the experimental imperfections (mode-mismatch, dark count and so on) and the assumption of the unit local detection efficiencies (η = 1). While the overall detection efficiencies of our system (η ∼ 15 %) are not the range of directly observing the violation of the CHSH inequality, S obtained by the experiment well agree with the numerical simulation with experimental parameters. When the overall transmission loss is set to be 10 dB, which corresponds to the transmittance of a 50 km-optical fiber, we observe Sexp = 1.478, while Sth = 1.487 is expected by the numerical simulation. This result means that our numerical simulation can rigorously model the experiment. This allows us to estimate the nonlocality of the quantum state just before the local detection losses by the numerical simulation. The CHSH value is estimated to be Sexpη=1= 2.104 > 2, which indicates that the quantum state with experimental imperfections possesses the potential to violate the CHSH inequality.