Microwave-assisted synthesis of benzothiazole and benzoxazole libraries via PIFA promoted cyclocondensation of 2-aminothiophenols/2-aminophenols with aldehydes under one-pot condition in good to excellent yields was achieved. Twenty compounds have been investigated for their analgesic activity and showed moderate to good activity.