We have carried out an investigation of the electro-chemical doping (ECD) of porous silicon (PS) with rare earth elements, especially Er was chosen for the main doping element in our work. Under certain conditions, after doping a blue shift was shown in the visible range photoluminescence (PL), and enhancement of PL intensity was observed. We address this that the impurity states in forbidden gap increase the optical probability of trapping carriers and the optical transition probability. Moreover, in the Infrared (IR) range, luminescence is observed around 1.54μm at room temperature and is assigned to the optical transitions from intra-4f energy levels of Er3+. X-ray Photo-electronic Spectroscopy (XPS) showed that at least 3 atomic percen of the rare earth element has been incorporated into porous silicon layer. In conclusion, by choosing suitable electrolyte, we successfully doped rare earth elements into porous silicon by electro-chemical method.