The capability to selectively and precisely modulate neural activities represents a powerful tool for neuroscience research and clinical therapeutics. Traditional electrical stimulations associate with bulky and tethered implants, and optogenetic methods rely on genetic modification for cell targeting. Here, we report an optoelectronic, non-genetic strategy for exciting and inhibiting neural activities, accomplished by bioresorbable, thin-film silicon (Si) diodes. Under illumination, these devices establish polarity-dependent, positive or negative voltages at the semiconductor/solution interface. Such photovoltaic signals enable deterministic depolarization and hyperpolarization of cultured neurons, upregulating and downregulating intracellular calcium dynamics in vitro. Furthermore, flexible, thin-film Si based devices mounted on the nerve tissue selectively activate and silence in vivo activities, both in the peripheral nerve and the brain. Finally, these Si membranes naturally dissolve within the animal body. Such a Si-based material and device platform offers broad potential for biomedical applications.