Recent experimental studies suggest that, in cortical microcircuits of the mammalian brain, the majority of neuron-to-neuron connections are realized by multiple synapses. However, it is not known whether such redundant synaptic connections provide any functional benefit. Here, we show that redundant synaptic connections enable near-optimal learning in cooperation with synaptic rewiring. By constructing a simple dendritic neuron model, we demonstrate that with multisynaptic connections, synaptic plasticity approximates a sample-based Bayesian filtering algorithm known as particle filtering, and wiring plasticity implements its resampling process. The derived synaptic plasticity rule accounts for many experimental observations, including the dendritic position dependence of spike-timing-dependent plasticity. The proposed framework is applicable to detailed single neuron models, and also to recurrent circuit models. Our study provides a novel conceptual framework for synaptic plasticity and rewiring.