This paper proposes a modified Particle Swarm Optimization (PSO) for multimodal function in a dynamic environment, with approaches, that uses inertia weight and change of the social component that is proportional to the number of iterations of the particle swarm. In multimodal case, PSO is expected to be able to find global and local optima, and to avoid trapped particles in the local optima before finding global optima. This study proposes the use of a parallel niche (sub swarm), with each niche having its own best value optima, and does not share these values. In dynamic environment case, PSO should find the optima value in every change of fitness function. Previous research has introduced detect and response method as a PSO solution for dynamic environments. This study proposes placing randomly sentry particles to detect the occurrence of changed fitness function for phase detection. Responding phase is done by searching optima value using improving velocity formula in social only mode. The weight of social component is accelerated to converge towards the optima value and decelerated to diverge by a sinusoidal function with period 0 and phi, and the inertia speed will be accelerated to the opposite direction. Finally, the algorithm has been tested using a benchmarking formula and it has shown a better result.