In this paper the use of pulse shaping in photoacoustic (PA) measurements is presented. The benefits of this approach are demonstrated by utilizing it for optimization of either the responsivity or the sensitivity of PA measurements. The optimization is based on the observation that the temporal properties of the PA effect can be represented as a linear system which can be fully characterized by its impulse response. Accordingly, the response of the PA system to an input optical pulse, whose instantaneous power is arbitrarily shaped, can be analytically predicted via a convolution between the pulse envelope and the PA impulse response. Additionally, the same formalism can be used to show that the response of the PA system to a pulse whose instantaneous power is a reversed version of the impulse response, i.e. a matched pulse, would exhibit optimal peak amplitude when compared with all other pulses with the same energy. Pulses can also be designed to optimize the sensitivity of the measurement to a variation in a specific system parameter. The use of the matched pulses can improve SNR and enable a reduction in the total optical energy required for obtaining a detectable signal. This may be important for applications where the optical power is restricted or for dynamical measurements where long integration times are prohibited. To implement this new approach, a novel PA optical setup which enabled synthesis of excitation waveforms with arbitrary temporal envelopes was constructed. The setup was based on a tunable laser source, operating in the near-IR range, and an external electro-optic modulator. Using this setup, our approach for system characterization and response prediction was tested and the superiority of the matched pulses over other common types of pulses of equal energy was demonstrated.